java.sql.Driver interface

The class that loads Derby's local JDBC driver is the class org.apache.derby.jdbc.EmbeddedDriver. The class that loads Derby's network client driver is the class org.apache.derby.jdbc.ClientDriver.

Usually, you will not need to create an instance of one of these classes, because the driver class is loaded and registered automatically when the java.sql.DriverManager class is initialized. That typically happens on the first call to a DriverManager method such as DriverManager.getConnection. This section describes a few exceptions to this rule.

With the embedded driver, if your application shuts down Derby or calls the DriverManager.deregisterDriver method, and you then want to reload the driver, call the Class.forName().newInstance() method to do so:


You also need to call the Class.forName method in this way if you need to boot the Derby engine without actually connecting to it -- for example, if you want to start an embedded Network Server instance. See, for example, "Overview of the SimpleNetworkServer Sample program" in the Derby Server and Administration Guide.

The actual driver that gets registered in the DriverManager to handle the jdbc:derby: protocol is not the class org.apache.derby.jdbc.EmbeddedDriver or org.apache.derby.jdbc.ClientDriver; that class simply detects the type of Derby driver needed and then causes the appropriate Derby driver to be loaded.

The only supported way to connect to a Derby system through the jdbc:derby: protocol is using the DriverManager to obtain a driver (java.sql.Driver) or connection (java.sql.Connection) through a getDriver or getConnection method call.

Related reference
java.sql.DriverManager.getConnection method
java.sql.Connection interface
java.sql.DatabaseMetaData interface
java.sql.Statement interface
java.sql.CallableStatement interface
java.sql.PreparedStatement interface
java.sql.ResultSet interface
java.sql.ResultSetMetaData interface
java.sql.SQLException class
java.sql.SQLWarning class
java.sql.SQLXML interface
java.sql.Savepoint interface
Mapping of java.sql.Types to SQL types
Features supported on JDBC 4.1 and above
JDBC 4.2-only features
JDBC escape syntax