Home > Articles

  • Print
  • + Share This
Like this article? We recommend

Running Your First Derby Program

To run the SimpleApp.java program, type the following commands:

javac SimpleApp.java
java SimpleApp

If all is well, you should see something like that illustrated in Listing 3.

Listing 3 SimpleApp.java application output

SimpleApp starting in embedded mode.
Loaded the appropriate driver.
Connected to and created database TestDB
Created table derbyDB
Inserted 1956 Webster
Inserted 1910 Union
Updated 1956 Webster to 180 Grand
Updated 180 Grand to 300 Lakeshore
Verified the rows
Dropped table derbyDB
Closed result set and statement
Committed transaction and closed connection
Database shut down normally
SimpleApp finished

If you made it this far, you successfully completed your first Derby program. The first time the program is run, the database is created, and you’ll notice a new folder called TestDB appearing in the same folder in which the program runs. TestDB contains the Derby database tables and represents the persistent data from the program. So, any data created by the program and stored in the database will find its way into the TestDB files.

In the next section, we’ll look at the elements that make up the SimpleApp.java program.

  • + Share This
  • 🔖 Save To Your Account