Package org.apache.derby.jdbc
Class AutoloadedDriver
- java.lang.Object
-
- org.apache.derby.jdbc.AutoloadedDriver
-
- All Implemented Interfaces:
java.sql.Driver
public class AutoloadedDriver extends java.lang.Object implements java.sql.Driver
This is the dummy driver which is registered with the DriverManager and which is autoloaded by JDBC4. Loading this class will NOT automatically boot the Derby engine, but it will register this class as a valid Driver with the DriverManager. Instead, the engine boots lazily when you ask for a Connection. Alternatively, you can force the engine to boot as follows:Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance(); // or new org.apache.derby.jdbc.EmbeddedDriver();
-
-
Field Summary
Fields Modifier and Type Field Description private static AutoloadedDriver
_autoloadedDriver
private static java.sql.Driver
_driverModule
private static boolean
_engineForcedDown
-
Constructor Summary
Constructors Constructor Description AutoloadedDriver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
acceptsURL(java.lang.String url)
Accept anything that starts withjdbc:derby:
.java.sql.Connection
connect(java.lang.String url, java.util.Properties info)
Connect to the URL if possibleprivate static void
deregisterDriver(AutoloadedDriver driver)
(package private) static java.sql.Driver
getDriverModule()
int
getMajorVersion()
Returns the driver's major version number.int
getMinorVersion()
Returns the driver's minor version number.java.util.logging.Logger
getParentLogger()
java.sql.DriverPropertyInfo[]
getPropertyInfo(java.lang.String url, java.util.Properties info)
Returns an array of DriverPropertyInfo objects describing possible properties.private static boolean
isBooted()
boolean
jdbcCompliant()
Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.private static AutoloadedDriver
makeAutoloadedDriver()
Load the most capable driver available.(package private) static void
registerDriverModule(java.sql.Driver driver)
Record which driver module actually booted.protected static void
registerMe(AutoloadedDriver me)
(package private) static void
unregisterDriverModule()
Unregister the driver and the AutoloadedDriver if exists.
-
-
-
Field Detail
-
_engineForcedDown
private static boolean _engineForcedDown
-
_autoloadedDriver
private static AutoloadedDriver _autoloadedDriver
-
_driverModule
private static java.sql.Driver _driverModule
-
-
Method Detail
-
registerMe
protected static void registerMe(AutoloadedDriver me)
-
acceptsURL
public boolean acceptsURL(java.lang.String url) throws java.sql.SQLException
Accept anything that starts withjdbc:derby:
.- Specified by:
acceptsURL
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
- if a database-access error occurs.- See Also:
Driver
-
connect
public java.sql.Connection connect(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
Connect to the URL if possible- Specified by:
connect
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
- illegal url or problem with connectiong- See Also:
Driver
-
getPropertyInfo
public java.sql.DriverPropertyInfo[] getPropertyInfo(java.lang.String url, java.util.Properties info) throws java.sql.SQLException
Returns an array of DriverPropertyInfo objects describing possible properties.- Specified by:
getPropertyInfo
in interfacejava.sql.Driver
- Throws:
java.sql.SQLException
- if a database-access error occurs.- See Also:
Driver
-
getMajorVersion
public int getMajorVersion()
Returns the driver's major version number.- Specified by:
getMajorVersion
in interfacejava.sql.Driver
- See Also:
Driver
-
getMinorVersion
public int getMinorVersion()
Returns the driver's minor version number.- Specified by:
getMinorVersion
in interfacejava.sql.Driver
- See Also:
Driver
-
jdbcCompliant
public boolean jdbcCompliant()
Report whether the Driver is a genuine JDBC COMPLIANT (tm) driver.- Specified by:
jdbcCompliant
in interfacejava.sql.Driver
- See Also:
Driver
-
getParentLogger
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfacejava.sql.Driver
- Throws:
java.sql.SQLFeatureNotSupportedException
-
getDriverModule
static java.sql.Driver getDriverModule() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
registerDriverModule
static void registerDriverModule(java.sql.Driver driver)
Record which driver module actually booted.- Parameters:
driver
- the driver register to DriverManager is not AutoloadedDriver
-
unregisterDriverModule
static void unregisterDriverModule()
Unregister the driver and the AutoloadedDriver if exists. This happens when the engine is forcibly shut down.
-
deregisterDriver
private static void deregisterDriver(AutoloadedDriver driver) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
isBooted
private static boolean isBooted()
-
makeAutoloadedDriver
private static AutoloadedDriver makeAutoloadedDriver()
Load the most capable driver available. But if the vm level doesn't support it, then we fall back on a lower-level driver.- Returns:
- AutoloadedDriver
-
-