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

Table 1 lists the methods in the Driver interface that are supported by DB2 Everyplace.

Table 1. 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, java.util.Hashtable info)

DB2 Everyplace overloaded method for class library configurations that do not support java.util.Properties. See connect(String url, Properties info) for supported key/value pairs.

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: DB2e_ENCODING

    Value: character encoding

  • Key: ENABLE_DELETE_PHYSICAL_REMOVE

    Value: true, false

    Default: false

  • Key: ENABLE_DIRTY_BIT_SET_BY_APPLICATION

    Value: true, false

    Default: false

  • Key: ENABLE_FILENAME_FORMAT_83

    Value: true, false

    Default: false

  • Key: ENABLE_IO_WRITETHROUGH

    Value: true, false

    Default (Windows® and Linux® x86 platforms only): false

    Default (Other platforms): true

    Restriction: The ENABLE_IO_WRITETHROUGH key affects only Windows and Linux x86 platforms. It has no effect on other platforms.
  • Key: ENABLE_READ_INCLUDE_MARKED_DELETE

    Value: true, false

    Default: false

  • Key: ENABLE_REORG

    Value: true, false

    Default: true

  • Key: ENABLE_SHARED_DATABASE_ACCESS

    Value: true, false

    Default: false

  • Key: ENABLE_TABLE_CHECKSUM

    Value: true, false

    Default: false

  • Key: LOCK_TIMEOUT

    Value: number of seconds to wait for a lock to be obtained before rolling back a transaction.

    Default: 20

  • Key: LOGIN_TIMEOUT

    Value: number of seconds to wait for a login request to complete before returning control to the application

    Default: 0

  • Key: password

    Value: user password

  • Key: user

    Value: user name

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™ driver.

Example: The following example illustrates how to create a Properties object and how to use the setProperty() method.
Properties props = new Properties();
props.setProperty("ENABLE_REORG", "false");
props.setProperty("LOCK_TIMEOUT", "200");
props.setProperty("ENABLE_SHARED_DATABASE_ACCESS" , "true");
props.setProperty("ENABLE_IO_WRITETHROUGH","true");
props.setProperty("ENABLE_TABLE_CHECKSUM", "true");
Connection con = DriverManager.getConnection(url, props);
Related tasks
Developing DB2 Everyplace Java applications
Related reference
SQLState messages reported by JDBC
Overview of DB2 Everyplace JDBC support


Library | Support | Terms of use

Last updated: Wednesday, October 17, 2006
(C) Copyright IBM Corporation 2004, 2006. All Rights Reserved.
This information center is built on Eclipse. (http://www.eclipse.org)