Top Description Constructors Methods
org.apache.derby.jdbc

public Class EmbeddedDriver

extends Object
implements Driver
Class Inheritance
All Implemented Interfaces
java.sql.Driver
Imports
java.io.PrintWriter, java.sql.Connection, .Driver, .DriverManager, .DriverPropertyInfo, .SQLException, .SQLFeatureNotSupportedException, java.util.Properties, java.util.logging.Logger, org.apache.derby.iapi.jdbc.AutoloadedDriver, .JDBCBoot, org.apache.derby.shared.common.reference.Attribute, org.apache.derby.impl.jdbc.Util

The embedded JDBC driver (Type 4) for Derby.

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.

See Also
java.sql.DriverManager, java.sql.DriverManager#getLogStream, java.sql.Driver, java.sql.SQLException

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
acceptsURL(String
the URL of the database
url
)

Implements java.sql.Driver.acceptsURL.

Accept anything that starts with 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.sql.Driver.connect.

Connect to the URL if possible
private Driver
getDriverModule()

Lookup the booted driver module appropriate to our JDBC level.

public int
getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Returns the driver's major version number.
public int
getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Returns the driver's minor version number.
public java.util.logging.Logger
getParentLogger()

Implements java.sql.Driver.getParentLogger.

Return the parent Logger of all the Loggers used by this driver.
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.sql.Driver.getPropertyInfo.

Returns an array of DriverPropertyInfo objects describing possible properties.
public boolean
jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EmbeddedDriverback to summary
public EmbeddedDriver()

Method Detail

acceptsURLback to summary
public boolean acceptsURL(String url) throws SQLException

Implements java.sql.Driver.acceptsURL.

Accept anything that starts with jdbc:derby:.

Parameters
url:String

Doc from java.sql.Driver.acceptsURL.

the URL of the database

Returns:boolean

Doc from java.sql.Driver.acceptsURL.

true if this driver understands the given URL; false otherwise

Exceptions
SQLException:
if a database-access error occurs.
See Also
java.sql.Driver
connectback to summary
public Connection connect(String url, Properties info) throws SQLException

Implements java.sql.Driver.connect.

Connect to the URL if possible

Parameters
url:String

Doc from java.sql.Driver.connect.

the URL of the database to which to connect

info:Properties

Doc from java.sql.Driver.connect.

a list of arbitrary string tag/value pairs as connection arguments. Normally at least a "user" and "password" property should be included.

Returns:Connection

Doc from java.sql.Driver.connect.

a Connection object that represents a connection to the URL

Exceptions
SQLException:
illegal url or problem with connectiong
See Also
java.sql.Driver
getDriverModuleback to summary
private Driver getDriverModule() throws SQLException

Lookup the booted driver module appropriate to our JDBC level.

getMajorVersionback to summary
public int getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Returns the driver's major version number.

Returns:int

Doc from java.sql.Driver.getMajorVersion.

this driver's major version number

See Also
java.sql.Driver
getMinorVersionback to summary
public int getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Returns the driver's minor version number.

Returns:int

Doc from java.sql.Driver.getMinorVersion.

this driver's minor version number

See Also
java.sql.Driver
getParentLoggerback to summary
public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException

Implements java.sql.Driver.getParentLogger.

Doc from java.sql.Driver.getParentLogger.

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.

Returns:java.util.logging.Logger

the parent Logger for this driver

Exceptions
SQLFeatureNotSupportedException:
if the driver does not use java.util.logging.
getPropertyInfoback to summary
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException

Implements java.sql.Driver.getPropertyInfo.

Returns an array of DriverPropertyInfo objects describing possible properties.

Parameters
url:String

Doc from java.sql.Driver.getPropertyInfo.

the URL of the database to which to connect

info:Properties

Doc from java.sql.Driver.getPropertyInfo.

a proposed list of tag/value pairs that will be sent on connect open

Returns:DriverPropertyInfo[]

Doc from java.sql.Driver.getPropertyInfo.

an array of DriverPropertyInfo objects describing possible properties. This array may be an empty array if no properties are required.

Exceptions
SQLException:
if a database-access error occurs.
See Also
java.sql.Driver
jdbcCompliantback to summary
public boolean jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.

Returns:boolean

Doc from java.sql.Driver.jdbcCompliant.

true if this driver is JDBC Compliant; false otherwise

See Also
java.sql.Driver