DBA > Job Interview Questions > DERBY Java Database FAQs

How to Start Derby as an Embedded Database?

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

How to Start Derby as an Embedded Database?

To start Derby, you start the Derby JDBC driver. Starting the Derby driver starts up the complete Derby system within the current JVM.

For example, when using the JBDC driver manager directly within Java code, you typically start a JDBC driver in one of two ways:

* Specify the jdbc.drivers system property, which allows users to customize the JDBC drivers used by their applications. For example:

java -Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver applicationClass

* Load the class directly from Java code using the static method Class.forName. For example:

Class.forName("org.apache.derby.jdbc.EmbeddedDriver");

Once the Derby JDBC driver class has been loaded, you can connect to any Derby database by passing the embedded connection URL with the appropriate attributes to the DriverManager.getConnection method.

For example:

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

(Continued on next question...)

Other Job Interview Questions