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.
| 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:
|
| 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. |
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);