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

Guest Author

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>

Join the discussion

Comments ( 8 )
  • Francois Orsini Sunday, May 7, 2006
    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.
  • Roumen Sunday, May 7, 2006
    Well, that explains it with Java Database. Still we should be renaming less... there are other infamous examples.
  • Alex Lam Monday, May 8, 2006

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

  • Clau Monday, May 8, 2006
    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?
  • guest Monday, May 8, 2006
    What I've meant is there isn't that capability in the GUI.
  • Francois Orsini Tuesday, May 9, 2006
    Yes, maybe someone missed it was supported by Derby ;-)
  • Clau Tuesday, May 9, 2006
    Yes, Francois, Derby supports auto-increment fields, but not NB 5 GUI. One have to set it manually
  • Aswin Anand Wednesday, May 10, 2006
    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?
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.