NetBeans Quick Tip #28 - Configuring Derby Database in NetBeans 5.0

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>

Nice post Roumen. Actually, Sun's supported distribution of Apache Derby is named Java DB and usually referred as 'JavaDB based on Apache Derby' - Sun cannot use Apache Derby as a brand name for its own distribution of the database, hence Java DB... IBM still has Cloudscape as its own supported distribution of Apache Derby. It is not atypical to see this but can get confusing definitely. Cheers.

Posted by Francois Orsini on květen 07, 2006 at 06:23 odp. CEST #

Well, that explains it with Java Database. Still we should be renaming less... there are other infamous examples.

Posted by Roumen on květen 08, 2006 at 01:23 dop. CEST #

So what exactly is the full name of Java again in 2006? :-P

Posted by Alex Lam on květen 08, 2006 at 02:10 odp. CEST #

One lack of feature I encountered with NB 5 and Derby is that you can't set a field to be auto-increment. Or am I missing something?

Posted by Clau on květen 08, 2006 at 03:05 odp. CEST #

What I've meant is there isn't that capability in the GUI.

Posted by guest on květen 08, 2006 at 03:33 odp. CEST #

Yes, maybe someone missed it was supported by Derby ;-)

Posted by Francois Orsini on květen 09, 2006 at 02:16 dop. CEST #

Yes, Francois, Derby supports auto-increment fields, but not NB 5 GUI. One have to set it manually

Posted by Clau on květen 09, 2006 at 11:37 dop. CEST #

Hi Roumen, after days of using netbeans, i just found out that 1 important feature is missing. File->New Project and you get a textbox for entering the project name. When i right click on the textbox, im unable to see the "Cut, Copy, Paste, Select All" menu. Getting used to it is different, but don't you think its an usability issue?

Posted by Aswin Anand on květen 10, 2006 at 02:51 dop. CEST #

Post a Comment:
Comments are closed for this entry.

Roman Strobl


« červen 2016