The driver automatically supports the correct JDBC specification version for the Java Virtual Machine's environment.
Loading this JDBC driver boots the database engine within the same Java virtual machine.
The correct code to load the Derby engine using this driver is (with approriate try/catch blocks):
Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
// or
new org.apache.derby.jdbc.EmbeddedDriver();
When loaded in this way, the class boots the actual JDBC driver indirectly.
The JDBC specification recommends the Class.ForName method without the .newInstance()
method call, but adding the newInstance() guarantees
that Derby will be booted on any Java Virtual Machine.
Note that you do not need to manually load the driver this way if you are running on Jave SE 6 or later. In that environment, the driver will be automatically loaded for you when your application requests a connection to a Derby database.
Any initial error messages are placed in the PrintStream supplied by the DriverManager. If the PrintStream is null error messages are sent to System.err. Once the Derby engine has set up an error logging facility (by default to derby.log) all subsequent messages are sent to it.
By convention, the class used in the Class.forName() method to boot a JDBC driver implements java.sql.Driver. This class is not the actual JDBC driver that gets registered with the Driver Manager. It proxies requests to the registered Derby JDBC driver.
java.sql.DriverManager , java.sql.DriverManager#getLogStream , java.sql.Driver , java.sql.SQLException
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | acceptsURL(String
the URL of the database url)Implements java. jdbc:derby:.
|
| public Connection | connect(String
the URL of the database to which to connect url, Properties a list of arbitrary string tag/value pairs as
connection arguments. Normally at least a "user" and
"password" property should be included. info)Implements java. |
| private Driver | |
| public int | getMajorVersion()
Implements java. |
| public int | getMinorVersion()
Implements java. |
| public java. | getParentLogger()
Implements java. |
| public DriverPropertyInfo[] | getPropertyInfo(String
the URL of the database to which to connect url, Properties a proposed list of tag/value pairs that will be sent on
connect open info)Implements java. |
| public boolean | jdbcCompliant()
Implements java. |
| EmbeddedDriver | back to summary |
|---|---|
| public EmbeddedDriver() | |
| acceptsURL | back to summary |
|---|---|
| public boolean acceptsURL(String url) throws SQLException Implements java. Accept anything that starts with
| |
| connect | back to summary |
|---|---|
| public Connection connect(String url, Properties info) throws SQLException Implements java. Connect to the URL if possible
| |
| getDriverModule | back to summary |
|---|---|
| private Driver getDriverModule() throws SQLException Lookup the booted driver module appropriate to our JDBC level. | |
| getMajorVersion | back to summary |
|---|---|
| public int getMajorVersion() Implements java. Returns the driver's major version number.
| |
| getMinorVersion | back to summary |
|---|---|
| public int getMinorVersion() Implements java. Returns the driver's minor version number.
| |
| getParentLogger | back to summary |
|---|---|
| public java. Implements java. Doc from java. Return the parent Logger of all the Loggers used by this driver. This should be the Logger farthest from the root Logger that is still an ancestor of all of the Loggers used by this driver. Configuring this Logger will affect all of the log messages generated by the driver. In the worst case, this may be the root Logger.
| |
| getPropertyInfo | back to summary |
|---|---|
| public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException Implements java. Returns an array of DriverPropertyInfo objects describing possible properties.
| |
| jdbcCompliant | back to summary |
|---|---|
| public boolean jdbcCompliant() Implements java. Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.
| |