AS400JDBCConnection class

The AS400JDBCConnection class provides a JDBC connection to a specific DB2® for IBM i database.

Use DriverManager.getConnection() to create new AS400JDBCConnection objects. For more information, see Registering the JDBC driver.

There are many optional properties that can be specified when the connection is created. Properties can be specified either as part of the URL or in a java.util.Properties object. See IBM Toolbox for Java JDBC properties for a complete list of properties supported by the AS400JDBCDriver.

Note: A connection may contain at most 9999 open statements.

AS400JDBCConnection includes support for savepoints and statement-level holdability, and limited support for returning auto-generated keys.

To use Kerberos tickets, set only the system name (and not the password) on your JDBC URL object. The user identity is retrieved through the Java Generic Security Services (JGSS) framework, so you also do not need to specify a user on your JDBC URL. You can set only one means of authentication in an AS400JDBCConnection object at a time. Setting the password clears any Kerberos ticket or profile token. For more information, see the AS400 class.

Using the AS400JDBCConnection class, you can do the following:

  • Create a statement (Statement, PreparedStatement, or CallableStatement objects)
  • Create a statement that has a specific result set type and concurrency (Statement, PreparedStatement, or CallableStatement objects)
  • Commit and rollback changes to the database and release database locks currently held
  • Close the connection, closing server resources immediately instead of waiting for them to be automatically released
  • Set holdability and get holdability for the Connection
  • Set the transaction isolation and get the transaction isolation for the Connection
  • Get the meta data for the Connection
  • Set auto commit on or off
  • Get the job identifier of the host server job that corresponds to the Connection

If you use JDBC 3.0 and connect to a server running IBM i 5.2 or later, you can use AS400JDBCConnection to perform the following actions:

  • Create a statement with a specific result set holdability (Statement, PreparedStatement, or CallableStatement object)
  • Create a prepared statement that returns any auto-generated keys (when getGeneratedKeys() is called on the Statement object)
  • Use savepoints, which offer more granular control over transactions:
    • Set savepoints
    • Rollback savepoints
    • Release savepoints