Top Description Fields Constructors Methods
org.h2

public Class Driver

extends Object
implements Driver, JdbcDriverBackwardsCompat
Class Inheritance
All Implemented Interfaces
org.h2.JdbcDriverBackwardsCompat, java.sql.Driver
Imports
java.sql.Connection, .DriverManager, .DriverPropertyInfo, .SQLException, java.util.Properties, java.util.logging.Logger, org.h2.api.ErrorCode, org.h2.engine.Constants, org.h2.jdbc.JdbcConnection, org.h2.message.DbException

The database driver. An application should not use this class directly. The only thing the application needs to do is load the driver. This can be done using Class.forName. To load the driver and open a database connection, use the following code:
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection(
     "jdbc:h2:˜/test", "sa", "sa");

Field Summary

Modifier and TypeField and Description
private static final ThreadLocal<Connection>
private static final String
private static final Driver
private static boolean

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

if the driver understands the URL
acceptsURL
(String
the database URL
url
)

Implements java.sql.Driver.acceptsURL.

Check if the driver understands this URL.

public Connection

Returns:

the new connection or null if the URL is not supported
connect
(String
the database URL
url
,
Properties
the connection properties
info
)

Implements java.sql.Driver.connect.

Open a database connection.

public int

Returns:

the major version number
getMajorVersion
()

Implements java.sql.Driver.getMajorVersion.

Get the major version number of the driver.

public int

Returns:

the minor version number
getMinorVersion
()

Implements java.sql.Driver.getMinorVersion.

Get the minor version number of the driver.

public java.util.logging.Logger
getParentLogger()

Implements java.sql.Driver.getParentLogger.

[Not supported]

public DriverPropertyInfo[]

Returns:

a zero length array
getPropertyInfo
(String
the database URL
url
,
Properties
the connection properties
info
)

Implements java.sql.Driver.getPropertyInfo.

Get the list of supported properties.

public boolean

Returns:

true
jdbcCompliant
()

Implements java.sql.Driver.jdbcCompliant.

Check if this driver is compliant to the JDBC specification.

public static synchronized Driver

Returns:

instance of the driver registered with the DriverManager
load
()

INTERNAL

public static void
setDefaultConnection(Connection
to set default to
c
)

INTERNAL Sets, on a per-thread basis, the default-connection for user-defined functions.

public static void
setThreadContextClassLoader(Thread
to set context class loader for
thread
)

INTERNAL

public static synchronized void
unload()

INTERNAL

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_CONNECTIONback to summary
private static final ThreadLocal<Connection> DEFAULT_CONNECTION
DEFAULT_URLback to summary
private static final String DEFAULT_URL
INSTANCEback to summary
private static final Driver INSTANCE
registeredback to summary
private static boolean registered

Constructor Detail

Driverback to summary
public Driver()

Method Detail

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

Implements java.sql.Driver.acceptsURL.

Check if the driver understands this URL. This method should not be called by an application.

Parameters
url:String

the database URL

Returns:boolean

if the driver understands the URL

Annotations
@Override
Exceptions
SQLException:
if URL is null
connectback to summary
public Connection connect(String url, Properties info) throws SQLException

Implements java.sql.Driver.connect.

Open a database connection. This method should not be called by an application. Instead, the method DriverManager.getConnection should be used.

Parameters
url:String

the database URL

info:Properties

the connection properties

Returns:Connection

the new connection or null if the URL is not supported

Annotations
@Override
Exceptions
SQLException:
on connection exception or if URL is null
getMajorVersionback to summary
public int getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Get the major version number of the driver. This method should not be called by an application.

Returns:int

the major version number

Annotations
@Override
getMinorVersionback to summary
public int getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Get the minor version number of the driver. This method should not be called by an application.

Returns:int

the minor version number

Annotations
@Override
getParentLoggerback to summary
public java.util.logging.Logger getParentLogger()

Implements java.sql.Driver.getParentLogger.

[Not supported]

Returns:java.util.logging.Logger

Doc from java.sql.Driver.getParentLogger.

the parent Logger for this driver

Annotations
@Override
getPropertyInfoback to summary
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info)

Implements java.sql.Driver.getPropertyInfo.

Get the list of supported properties. This method should not be called by an application.

Parameters
url:String

the database URL

info:Properties

the connection properties

Returns:DriverPropertyInfo[]

a zero length array

Annotations
@Override
jdbcCompliantback to summary
public boolean jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Check if this driver is compliant to the JDBC specification. This method should not be called by an application.

Returns:boolean

true

Annotations
@Override
loadback to summary
public static synchronized Driver load()

INTERNAL

Returns:Driver

instance of the driver registered with the DriverManager

setDefaultConnectionback to summary
public static void setDefaultConnection(Connection c)

INTERNAL Sets, on a per-thread basis, the default-connection for user-defined functions.

Parameters
c:Connection

to set default to

setThreadContextClassLoaderback to summary
public static void setThreadContextClassLoader(Thread thread)

INTERNAL

Parameters
thread:Thread

to set context class loader for

unloadback to summary
public static synchronized void unload()

INTERNAL