O'Reilly logo

Apache Derby—Off to the Races: Includes Details of IBM® Cloudscape™ by Dan Scott, George Baklarz, Paul C. Zikopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Establishing a Database Connection

After an application has loaded the appropriate driver, it can establish a connection to the database. To connect to an embedded Apache Derby database, use the following getConnection() method:

Connection conn = null;
conn = DriverManager.getConnection("jdbc:derby:YMLD"); 

The getConnection URL takes the form jdbc:derby:[subprotocol:][databasename][;attributes].

  • subprotocol is rarely used in the connection URL. This option specifies where Apache Derby should look for a database. This can be in a directory, a class path, or in a .JAR file. The majority of the time, this option is used for read-only databases.

  • databasename specifies a database name, with or without a relative or absolute path.

  • attributes specifies ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required