How to Installing and Running Java Database

Installing and running the Java Data Base Connectivity (JDBC) with

This is designed for eclipse so I recommend downloading it from

  1. Create a new project (in eclipse)
    1. File → New → Java Project
    2. Type in a name (one word, no spaces, no special characters)
      • below, I named it ‘JavaDB1’
    3. Click the Finish button
  2. Drag into the project
    1. On the left side of eclipse is the ‘Package Explorer’
    2. Click on the right arrow in from of the project name ‘JavaDB1’ (see above)
    3. Open up the until you see the ‘src’ (source) folder. Then drag ‘’ to the src folder. It may ask you if you want to move or copy the files. Copy is fine.
    4. Double-click on and the file will appear in the editor.
  3. Add the External JAR files
    1. from the menu, go to Project → Properties
    2. In the “Properties for project_name” configuration box (where project_name is the name of your project. Here, mine is called ‘JavaDB1’, so it reads “Properties for JavaDB1”, click on the ‘Libraries’ tab.
    3. Select ‘Java Build Path’ in the left column.
    4. Click on the ‘Add External JARs…’ button on the right.
    5. A new dialog box will open.
    6. Select the file ‘derby.jar’. If there are problems running the program, add ‘derbyclient.jar’. If problems continue, add ‘derbynet.jar’, ‘derbyrun.jar’ and ‘derbytools.jar’. However, ‘derby.jar’s should be all that is needed.
    7. Click the ‘OK’ button
  4. Run the program
    1. Click on the Green ‘run’ button. Eclipse does the compile and run as a single step.
    2. If all goes well, the program will display the following
      SimpleApp starting in embedded mode
      Loaded the appropriate driver
      Connected to and created database derbyDB

      Created table location
      Inserted 1956 Webster
      Inserted 1910 Union
      Updated 1956 Webster to 180 Grand
      Updated 180 Grand to 300 Lakeshore
      Verified the rows
      Dropped table location
      Committed the transaction
      Derby shut down normally
      SimpleApp finished

    3. And that’s it!
  5. The database itself
    1. In the code, there is this line
      s.execute("create table location(num int, addr varchar(40))");</li>
    2. This line creates a table named ‘location’ with two values, an integer named ‘num’ and
      a string of up to 40 characters named ‘addr’.
    3. These 3 lines insert ‘1956’ as integer number 1 and ‘Webster St.’ as the string. The last statement executes the SQL command.
               psInsert.setInt(1, 1956);
               psInsert.setString(2, "Webster St.");
    4. The update commands are as follows:
               psUpdate.setInt(1, 180);
               psUpdate.setString(2, "Grand Ave.");
    5. And that is how SQL works. Now, with a few changes, you can include the course project into this.