Skip to content

Most visited

Recently visited

navigation
Added in API level 1

Driver

public interface Driver

java.sql.Driver


An interface to a JDBC driver. Instances are returned by DriverManager.

The JDBC driver uses URLs to specify the location of specific data. URL format typically takes the form " xxxx:yyyy:SpecificData", where " xxxx:yyyy" is referred to as the subprotocol and is normally the same for all of a particular driver. " SpecificData" is a string which identifies the particular data source that the driver should use.

See also:

Summary

Public methods

abstract boolean acceptsURL(String url)

Returns whether the driver thinks that it can open a connection to the given URL.

abstract Connection connect(String url, Properties info)

Attempts to make a database connection to a data source specified by a supplied URL.

abstract int getMajorVersion()

Gets the driver's major version number.

abstract int getMinorVersion()

Gets the driver's minor version number.

abstract DriverPropertyInfo[] getPropertyInfo(String url, Properties info)

Gets information about possible properties for this driver.

abstract boolean jdbcCompliant()

Reports whether this driver is a genuine JDBC CompliantTM driver.

Public methods

acceptsURL

Added in API level 1
boolean acceptsURL (String url)

Returns whether the driver thinks that it can open a connection to the given URL.

Parameters
url String: the URL to connect to.
Returns
boolean true if the driver thinks that is can open a connection to the supplied URL, false otherwise. Typically, the driver will respond true if it thinks that it can handle the subprotocol specified by the driver.
Throws
SQLException if a database error occurs.

connect

Added in API level 1
Connection connect (String url, 
                Properties info)

Attempts to make a database connection to a data source specified by a supplied URL.

Parameters
url String: the URL to connect.
info Properties: some properties that should be used in establishing the connection. The properties consist of name/value pairs of strings. Normally, a connection to a database requires at least two properties - for "user" and "password" in order to pass authentication to the database.
Returns
Connection the connection to the database.
Throws
SQLException if a database error occurs.

getMajorVersion

Added in API level 1
int getMajorVersion ()

Gets the driver's major version number.

Returns
int the major version number of the driver - typically starts at 1.

getMinorVersion

Added in API level 1
int getMinorVersion ()

Gets the driver's minor version number.

Returns
int the minor version number of the driver - typically starts at 0.

getPropertyInfo

Added in API level 1
DriverPropertyInfo[] getPropertyInfo (String url, 
                Properties info)

Gets information about possible properties for this driver.

This method is intended to provide a listing of possible properties that the client of the driver must supply in order to establish a connection to a database. Note that the returned array of properties may change depending on the supplied list of property values.

Parameters
url String: the URL of the database. An application may call this method iteratively as the property list is built up - for example, when displaying a dialog to an end-user as part of the database login process.
info Properties: a set of tag/value pairs giving data that a user may be prompted to provide in order to connect to the database.
Returns
DriverPropertyInfo[] an array of DriverPropertyInfo records which provide details on which additional properties are required (in addition to those supplied in the info parameter) in order to connect to the database.
Throws
SQLException if a database error occurs.

jdbcCompliant

Added in API level 1
boolean jdbcCompliant ()

Reports whether this driver is a genuine JDBC CompliantTM driver. The driver may only return true if it passes all the JDBC compliance tests.

A driver may not be fully compliant if the underlying database has limited functionality.

Returns
boolean true if the driver is fully JDBC compliant, false otherwise.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.