All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.as400.access.AS400JDBCDriver

java.lang.Object
   |
   +----com.ibm.as400.access.AS400JDBCDriver

public class AS400JDBCDriver
extends Object
implements Driver

The AS400JDBCDriver class is a JDBC 2.0 driver that accesses DB2 for OS/400 databases.

To use this driver, the application or caller must register the driver with the JDBC DriverManager. This class also registers itself automatically when it is loaded.

After registering the driver, applications make connection requests to the DriverManager, which dispatches them to the appropriate driver. This driver accepts connection requests for databases specified by the URLs that match the following syntax:

jdbc:as400://server-name/default-schema;properties

The driver uses the specified server name to connect to a corresponding AS/400 server. If a server name is not specified, then the user will be prompted.

The default schema is optional and the driver uses it to resolve unqualified names in SQL statements. If no default schema is set, then the driver resolves unqualified names based on the naming convention for the connection. If SQL naming is being used, and no default schema is set, then the driver resolves unqualified names using the schema with the same name as the user. If system naming is being used, and no default schema is set, then the driver resolves unqualified names using the server job's library list. See JDBC properties for more details on how to set the naming convention and library list.

Several properties can optionally be set within the URL. They are separated by semicolons and are in the form:

name1=value1;name2=value2;...
See JDBC properties for a complete list of properties supported by this driver.

The following example URL specifies a connection to the database on server mysystem.helloworld.com with mylibrary as the default schema. The connection will use the system naming convention and return full error messages:

jdbc:as400://mysystem.helloworld.com/mylibrary;naming=system;errors=full


Constructor Index

 o AS400JDBCDriver()

Method Index

 o acceptsURL(String)
Indicates if the driver understands how to connect to the database named by the URL.
 o connect(String, Properties)
Connects to the database named by the specified URL.
 o getMajorVersion()
Returns the driver's major version number.
 o getMinorVersion()
Returns the driver's minor version number.
 o getPropertyInfo(String, Properties)
Returns an array of DriverPropertyInfo objects that describe the properties that are supported by this driver.
 o jdbcCompliant()
Indicates if the driver is a genuine JDBC compliant driver.
 o toString()
Returns the name of the driver.

Constructors

 o AS400JDBCDriver
 public AS400JDBCDriver()

Methods

 o acceptsURL
 public boolean acceptsURL(String url) throws SQLException
Indicates if the driver understands how to connect to the database named by the URL.

Parameters:
url - The URL for the database.
Returns:
true if the driver understands how to connect to the database; false otherwise.
Throws: SQLException
If an error occurs.
 o connect
 public Connection connect(String url,
                           Properties info) throws SQLException
Connects to the database named by the specified URL. There are many optional properties that can be specified. Properties can be specified either as part of the URL or in a java.util.Properties object. See JDBC properties for a complete list of properties supported by this driver.

Parameters:
url - The URL for the database.
info - The connection properties.
Returns:
The connection to the database or null if the driver does not understand how to connect to the database.
Throws: SQLException
If the driver is unable to make the connection.
 o getMajorVersion
 public int getMajorVersion()
Returns the driver's major version number.

Returns:
The major version number.
 o getMinorVersion
 public int getMinorVersion()
Returns the driver's minor version number.

Returns:
The minor version number.
 o getPropertyInfo
 public DriverPropertyInfo[] getPropertyInfo(String url,
                                             Properties info) throws SQLException
Returns an array of DriverPropertyInfo objects that describe the properties that are supported by this driver.

Parameters:
url - The URL for the database.
info - The connection properties.
Returns:
The descriptions of all possible properties or null if the driver does not understand how to connect to the database.
Throws: SQLException
If an error occurs.
 o jdbcCompliant
 public boolean jdbcCompliant()
Indicates if the driver is a genuine JDBC compliant driver.

Returns:
Always true.
 o toString
 public String toString()
Returns the name of the driver.

Returns:
The driver name.
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index