|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.as400.access.AS400JDBCConnection
The AS400JDBCConnection class provides a JDBC connection to a specific DB2 for OS/400 database. Use DriverManager.getConnection() to create new AS400JDBCConnection objects.
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 JDBC properties for a complete list of properties supported by the AS400JDBCDriver.
Note that a connection may contain at most 9999 open statements.
Fields inherited from interface java.sql.Connection |
TRANSACTION_NONE,
TRANSACTION_READ_COMMITTED,
TRANSACTION_READ_UNCOMMITTED,
TRANSACTION_REPEATABLE_READ,
TRANSACTION_SERIALIZABLE |
Method Summary | |
void |
clearWarnings()
Clears all warnings that have been reported for the connection. |
void |
close()
Releases the connection's resources immediately instead of waiting for them to be automatically released. |
void |
commit()
Commits all changes made since the previous commit or rollback and releases any database locks currently held by the connection. |
java.sql.Statement |
createStatement()
Creates a Statement object for executing SQL statements without parameters. |
java.sql.Statement |
createStatement(int resultSetType,
int resultSetConcurrency)
Creates a Statement object for executing SQL statements without parameters. |
protected void |
finalize()
Closes the connection if not explicitly closed by the caller. |
boolean |
getAutoCommit()
Returns the auto-commit state. |
java.lang.String |
getCatalog()
Returns the catalog name. |
java.sql.DatabaseMetaData |
getMetaData()
Returns the DatabaseMetaData object that describes the connection's tables, supported SQL grammar, stored procedures, capabilities and more. |
java.lang.String |
getServerJobIdentifier()
Returns the job identifier of the host server job corresponding to this connection. |
AS400 |
getSystem()
Returns the system object which is managing the connection to the AS/400. |
int |
getTransactionIsolation()
Returns the transaction isolation level. |
java.util.Map |
getTypeMap()
Returns the type map. |
java.sql.SQLWarning |
getWarnings()
Returns the first warning reported for the connection. |
boolean |
isClosed()
Indicates if the connection is closed. |
boolean |
isReadOnly()
Indicates if the connection is in read-only mode. |
java.lang.String |
nativeSQL(java.lang.String sql)
Returns the native form of an SQL statement without executing it. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql)
Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. |
java.sql.CallableStatement |
prepareCall(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Precompiles an SQL stored procedure call with optional input and output parameters and stores it in a CallableStatement object. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql)
Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. |
java.sql.PreparedStatement |
prepareStatement(java.lang.String sql,
int resultSetType,
int resultSetConcurrency)
Precompiles an SQL statement with optional input parameters and stores it in a PreparedStatement object. |
void |
rollback()
Drops all changes made since the previous commit or rollback and releases any database locks currently held by the connection. |
void |
setAutoCommit(boolean autoCommit)
Sets the auto-commit mode. |
void |
setCatalog(java.lang.String catalog)
This method is not supported. |
void |
setReadOnly(boolean readOnly)
Sets the read-only mode. |
void |
setTransactionIsolation(int level)
Sets the transaction isolation level. |
void |
setTypeMap(java.util.Map typeMap)
Sets the type map to be used for distinct and structured types. |
java.lang.String |
toString()
Returns the connection's catalog name. |
Methods inherited from class java.lang.Object |
clone,
equals,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Method Detail |
public void clearWarnings() throws java.sql.SQLException
public void close() throws java.sql.SQLException
public void commit() throws java.sql.SQLException
This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.
public java.sql.Statement createStatement() throws java.sql.SQLException
Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.
public java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
resultSetType
- The result set type. Valid values are:
resultSetConcurrency
- The result set concurrency. Valid values are:
protected void finalize() throws java.lang.Throwable
public boolean getAutoCommit() throws java.sql.SQLException
public java.lang.String getCatalog() throws java.sql.SQLException
public java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
public java.lang.String getServerJobIdentifier()
Note: Since this method is not defined in the JDBC Connection interface, you typically need to cast a Connection object to AS400JDBCConnection in order to call this method:
String serverJobIdentifier = ((AS400JDBCConnection)connection).getServerJobIdentifier();
public AS400 getSystem()
Note: Since this method is not defined in the JDBC Connection interface, you typically need to cast a Connection object to AS400JDBCConnection in order to call this method:
AS400 system = ((AS400JDBCConnection)connection).getSystem();
public int getTransactionIsolation() throws java.sql.SQLException
public java.util.Map getTypeMap() throws java.sql.SQLException
This driver does not support the type map.
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException
public boolean isClosed() throws java.sql.SQLException
public boolean isReadOnly() throws java.sql.SQLException
public java.lang.String nativeSQL(java.lang.String sql) throws java.sql.SQLException
sql
- The SQL statement in terms of the JDBC SQL grammar.public java.sql.CallableStatement prepareCall(java.lang.String sql) throws java.sql.SQLException
Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.
sql
- The SQL stored procedure call.public java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
sql
- The SQL statement.resultSetType
- The result set type. Valid values are:
resultSetConcurrency
- The result set concurrency. Valid values are:
public java.sql.PreparedStatement prepareStatement(java.lang.String sql) throws java.sql.SQLException
Result sets created using the statement will be type ResultSet.TYPE_FORWARD_ONLY and concurrency ResultSet.CONCUR_READ_ONLY.
sql
- The SQL statement.public java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
sql
- The SQL statement.resultSetType
- The result set type. Valid values are:
resultSetConcurrency
- The result set concurrency. Valid values are:
public void rollback() throws java.sql.SQLException
This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.
public void setAutoCommit(boolean autoCommit) throws java.sql.SQLException
By default, the connection is in auto-commit mode. The commit occurs when the statement execution completes or the next statement execute occurs, whichever comes first. In the case of statements returning a result set, the statement execution completes when the last row of the result set has been retrieved or the result set has been closed. In advanced cases, a single statement may return multiple results as well as output parameter values. Here the commit occurs when all results and output parameter values have been retrieved.
The auto-commit mode is always false when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.
autoCommit
- true to turn on auto-commit mode, false to
turn it off.public void setCatalog(java.lang.String catalog) throws java.sql.SQLException
public void setReadOnly(boolean readOnly) throws java.sql.SQLException
This method can not be called when the connection is part of a distributed transaction. See AS400JDBCXAResource for more information.
public void setTransactionIsolation(int level) throws java.sql.SQLException
JDBC and DB2/400 use different terminology for transaction isolation levels. The following table provides a terminology mapping:
AS/400 isolation level | JDBC transaction isolation level |
---|---|
*CHG | TRANSACTION_READ_UNCOMMITTED |
*CS | TRANSACTION_READ_COMMITTED |
*ALL | TRANSACTION_READ_REPEATABLE_READ |
*RR | TRANSACTION_SERIALIZABLE |
level
- The transaction isolation level. Possible
values are:
public void setTypeMap(java.util.Map typeMap) throws java.sql.SQLException
Note: Distinct types are supported by DB2 for OS/400, but are not externalized by the AS/400 Toolbox for Java JDBC driver. In other words, distinct types behave as if they are the underlying type. Structured types are not supported by DB2 for OS/400. Consequently, this driver does not support the type map.
typeMap
- The type map.public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |