Driver interface

The Driver interface is the Java SQL framework that allows for multiple database drivers.

When a Driver class is loaded, it should create an instance of itself and register it with the DriverManager. This means that a user can load and register the DB2 Everyplace JDBC driver by calling:

Class.forName("com.ibm.db2e.jdbc.DB2eDriver")

java.sql package

public interface Driver

Tabulka 100 lists the methods in the Driver interface that are supported by DB2 Everyplace.

Tabulka 100. Driver interface methods

Method return value type Method
boolean acceptsURL(String url)Returns true if the driver thinks that it can open a connection to the given URL.
Connection connect(String url, Properties info) Attempts to make a database connection to the given URL. The java.util.Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. DB2 Everyplace supports the following driver-specific key and value pairs:

  • Key: LOGIN_TIMEOUT

    Value: number of seconds

  • Key: DB2e_ENCODING

    Value: character encoding

int getMajorVersion() Gets the driver's major version number.
int getMinorVersion() Gets the driver's minor version number.
boolean jdbcCompliant() Reports whether this driver is a genuine JDBC COMPLIANT(TM) driver.

Související úlohy

Související odkazy