Site Sponsors:
New Release of Derby & Eclipse 
Last month was certainly a red-letter celebration! Why? Because - for most of us Java enthusiasts - we were blessed with both a new release of Eclipse (from Indigo to Juno), as well as a new release of Apache's Derby SQL Database.


Eclipse Juno is cool enough. Despite the other enhancements, right out of the box I noticed lots of new hints. Suggestions that even made ClassIO (a project I was playing with at the time) a little better.

But then there is Derby: For those of us who like to write stand-alone applications, there is nothing more important than providing reliable data storage.

Indeed, when thoughts turn to SQL and Java, there is little more refreshing than using Apache's Derby Database. No licenses, no hassles, and 100% embeddable ("embeddable" == no nasty database sql server to set up, license, upgrade, integrate, patch-patch-patch, manage, etc.)

Sourcing Derby

Like most things Java, all things Derby begin with the .jar file. For those who do not already have a copy of derby.jar floating about their folders, the first thing to do is to download and ''install'' a copy:

1.) We can download the Derby Database [here].

2.) Once downloaded, open the archive and copy the folder therein to somewhere special.

3.) Finally, locate & associate the enclosed derby.jar with you project. -For both Eclipse and Netbeans, all we have to do is to add that jar to our project.

Thats it! No matter if we are liking either Netbeans or Eclipse, all we need to do is to use that derby.jar.

Using Derby.jar

Okay - I admit that I am not the biggest fan of Eclipse. Why? Because - for those of us who like to manually back-up and manage our source code, handing a copy of the IDE to a new software developer is like handing a loaded gun to a teenager. -While things often work out completely okay (all of our kids are marksmen :), all can go horrifically wrong. Certainly for folks operating under the influence of Hollywood. =)

Yet when it comes to re-using things like derby.jar, both Eclipse and Netbeans have a real simple way to associate a jar with a Project. Once a Project has been created, we can leverage just about any external jar by:

For Eclipse: Simply select "Project" then "Properties" from the main menu. Thereafter, all we need do is to click on "Java Build Path", then click on the "Add External Jars..." Button.

For Netbeans: Merely right-click on your project to select "Properties". Select "Libraries" in the list-box, then click the "Add JAR/Folder" Button.

For Both: Once we see either IDE's JAR Selection Dialog, we merely need to browse to that lib folder in our ''special place'' to locate that derby.jar Archive, and all is well. The archive will be included alongside of any and all related artifacts for our project.

Dedicated Database Connections

While extending Derby capabilities to our project is good, at some point everyone will want to integrate their databases into a production environment.

Derby Sessions

For Netbeans: From the main-menu, simply select "Windows", then "Services." After expansing the "Drivers" entry under the "Services" Tab, we can right click to manage our Derby, Oracle, Postgres, and / or MySQL connections with impunity.

For Eclipse: The first thing to do under Eclipse is to switch into that all-powerful "Database Development" prospective. Once there:

(1) Right-click on Databases Connections to select that New… popup-menu, item.

(2) Within the Connection Profile Dialog, select the Derby set of platters, then click Next.

(3) If the New Derby Connection Profile is stark naked, then we will most probably have to create a New Driver Definition.

(3a) We can create a new driver by pressing the button to the right of the Drivers: text-box.

(3b) When creating a New Driver Definition, the JEE Eclipse - Juno install base I am presently using lists 10 templates. For my stand-alone purposes, I selected the Derby Embedded JDBC Driver. Most folks will want to use the Derby Client.

(3c) Once selected, simply tab-over to the JAR List Page, to press the Edit JAR/Zip Button.

(3d) Once we see the Select the file: Dialog, browse to the lib sub-Folder in that ''special place'' to locate & select that derby.jar (or derby-client.jar) Archive.

(4) Mash on finish, then go set-up your database.

(*) If this is the FIRST TIME to run your driver definition (and even if it ain't!), in order to save everyone some stress in a classroom situation BE SURE to use that TEST CONNECTION Button! The first time 'round, be prepared to wait a handful of seconds for that "Ping Succeeded!" message...

Happy 5th of July!



Add Comment
Comments are not available for this entry.