|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.as400.access.AS400JDBCDriver
The AS400JDBCDriver class is a JDBC 2.0 driver that accesses DB2 UDB for iSeries 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 or iSeries 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 Summary | |
---|---|
AS400JDBCDriver()
|
Method Summary | |
---|---|
boolean |
acceptsURL(String url)
Indicates if the driver understands how to connect to the database named by the URL. |
Connection |
connect(AS400 system)
Connects to the database on the specified system. |
Connection |
connect(AS400 system,
boolean clone)
Connects to the database on the specified system. |
Connection |
connect(AS400 system,
Properties info,
String schema)
Connects to the database on the specified system. |
Connection |
connect(AS400 system,
Properties info,
String schema,
boolean clone)
Connects to the database on the specified system. |
Connection |
connect(String url,
Properties info)
Connects to the database named by the specified URL. |
int |
getMajorVersion()
Returns the driver's major version number. |
int |
getMinorVersion()
Returns the driver's minor version number. |
DriverPropertyInfo[] |
getPropertyInfo(String url,
Properties info)
Returns an array of DriverPropertyInfo objects that describe the properties that are supported by this driver. |
boolean |
jdbcCompliant()
Indicates if the driver is a genuine JDBC compliant driver. |
String |
toString()
Returns the name of the driver. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public AS400JDBCDriver()
Method Detail |
public boolean acceptsURL(String url) throws SQLException
acceptsURL
in interface Driver
url
- The URL for the database.
SQLException
- If an error occurs.public Connection connect(String url, Properties info) throws SQLException
connect
in interface Driver
url
- The URL for the database.info
- The connection properties.
SQLException
- If the driver is unable to make the connection.public Connection connect(AS400 system) throws SQLException
Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect (o);
system
- The AS/400 or iSeries server to connect.
SQLException
- If the driver is unable to make the connection.public Connection connect(AS400 system, boolean clone) throws SQLException
Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect (o, false);
system
- The AS/400 or iSeries server to connect.clone
- True if the AS400 object should be cloned, false otherwises
SQLException
- If the driver is unable to make the connection.public Connection connect(AS400 system, Properties info, String schema, boolean clone) throws SQLException
Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); AS400 o = new AS400(myAS400, myUserId, myPwd); String mySchema = "defaultSchema"; Properties prop = new Properties(); Connection c = d.connect (o, prop, mySchema, false);
system
- The AS/400 or iSeries server to connect.info
- The connection properties.schema
- The default schema or null meaning no default schema specified.clone
- True if the AS400 object should be cloned, false otherwises
SQLException
- If the driver is unable to make the connection.public Connection connect(AS400 system, Properties info, String schema) throws SQLException
Note: Since this method is not defined in the JDBC Driver interface, you typically need to create a Driver object in order to call this method:
AS400JDBCDriver d = new AS400JDBCDriver(); String mySchema = "defaultSchema"; Properties p = new Properties(); AS400 o = new AS400(myAS400, myUserId, myPwd); Connection c = d.connect (o, p, mySchema);
system
- The AS/400 or iSeries server to connect.info
- The connection properties.schema
- The default schema or null meaning no default schema specified.
SQLException
- If the driver is unable to make the connection.public int getMajorVersion()
getMajorVersion
in interface Driver
public int getMinorVersion()
getMinorVersion
in interface Driver
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
getPropertyInfo
in interface Driver
url
- The URL for the database.info
- The connection properties.
SQLException
- If an error occurs.public boolean jdbcCompliant()
jdbcCompliant
in interface Driver
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |