NetBeans Quick Tip #28 - Configuring Derby Database in NetBeans 5.0
By Roman Strobl on V 07, 2006
If you want to use the integrated Derby database in NetBeans 5.0, you have the following options:
1. Download and install NetBeans with the Sun Appserver bundle. Then you don't need to do download and install Derby, because Sun Appserver installation contains the Derby database.
2. If you don't install the Appserver bundle bundle, you will need to download and unzip Derby to a directory in your disc. That's all you need to do, you can skip the rest of the installation process because the NetBeans integration takes care of everything - it knows how to start the server, etc.
As the next step you need to tell NetBeans where to find the Derby database. Go to Tools | Options and jump to Advanced Options | IDE Configuration | Server and External Tool Settings | Derby Database. Here set the directory where you unzipped Derby (e.g. c:/derby) and the location of your database (e.g. c:/derby/database) - this directory will be created for you if it doesn't exist. Now you can go to Tools | Derby Database and start the Derby server or create a database (this submenu was not available before):
If you're using NetBeans 5.5 daily build, just go to the update center and install Derby from the update server - that's the easiest way to set Derby up, but unfortunately not available for 5.0.
What can you do once the database is set up? You can connect to the database in the Runtime tab by either the embedded driver or the client server driver. If the database server is not running it gets started automatically. You can execute queries with the built-in SQL editor, browse the data, create new tables or alter existing tables. You can also create new database and set the privileges to it. Basicly you can do anything you need to work with a database from the IDE. For more information see this tutorial from Brian.
<rant>Did you notice I don't call Derby database the "Java Database"? Well, I still can't get used to calling Derby a Java Database and I hope that Sun will stop for once this renaming maddness :( Sun, please don't rename technologies all the time, it just makes everybody confused. Thank you.</rant>