I'm working on updating one of our EJB courses and I needed to add a Java DB database to my machine so I could deploy an Enterprise Application. Of course, in my first attempt to create the database, I completely hosed it. Consequently, I needed to delete it and start over. Now this isn't very easy cause a bunch of configuration files get created when you create a Java DB database with NetBeans. So here is what I learned from my little escapade.
DB Settings for an EJB Container
This is where I should have gone first but didn't. All the information about databases for an EJB project can be found in: project-ejb\setup\sun-resources.xml
. This file shows the database name, user name, password, port number, etc... Go here first if you need to figure out this information when it isn't provided to you.
Location of Derby Directory
Java DB is based off of the Apache Derby open source database project. So the database files are stored in a Derby directory. But where? On Windows you can find the directory here: C:\Documents and Settings\UserName\.netbeans-derby
. You will find a directory for each Java DB database you have created. To delete the database, just delete the directory.
Delete old Database Connections from NetBeans
When you create a Java DB database, NetBeans automatically creates a connection for that DB. Now you should be able to delete the connection from the UI by right clicking it and selecting delete. For whatever reason, that was not working for me. So I had to find where this list was stored. I found it here on Windows: C:\Documents and Settings\UserName\.netbeans\6.1\config\Databases\Connections
. Each connection is stored in an XML file. Delete the file and the connection is removed. You may need to restart NetBeans to see the connection removed from the UI.
This sums up my little adventure. After installing the database with the correct user name and password, deployment was a breeze. Woo hoo!
No comments:
Post a Comment