ConnectionRepresents a connection (session) to a database.
void clearWarnings() throws SQLExceptionClears all warnings.void close() throws SQLExceptionCloses this connection. All open statements, prepared statements and result sets that where created by this connection become invalid after calling this method. If there is an uncommitted transaction, it will be rolled back.void commit() throws SQLExceptionCommits the current transaction. This call has only an effect if auto commit is switched off.Throws:
SQLException - if the connection is closed
Blob createBlob() throws SQLExceptionCreate a new empty Blob object.Returns:
the object
Clob createClob() throws SQLExceptionCreate a new empty Clob object.Returns:
the object
Statement createStatement() throws SQLExceptionCreates a new statement.Returns:
the new statement
Throws:
SQLException - if the connection is closed
Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLExceptionCreates a statement with the specified result set type and concurrency.Returns:
the statement
Throws:
SQLException - if the connection is closed or the result set type or
concurrency are not supported
Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionCreates a statement with the specified result set type, concurrency, and holdability.Returns:
the statement
Throws:
SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supported
boolean getAutoCommit() throws SQLExceptionGets the current setting for auto commit.Returns:
true for on, false for off
Throws:
SQLException - if the connection is closed
String getCatalog() throws SQLExceptionGets the current catalog name.Throws:
SQLException - if the connection is closed
int getHoldability() throws SQLExceptionReturns the current result set holdability.Returns:
the holdability
Throws:
SQLException - if the connection is closed
DatabaseMetaData getMetaData() throws SQLExceptionGets the database meta data for this database.Returns:
the database meta data
Throws:
SQLException - if the connection is closed
int getTransactionIsolation() throws SQLExceptionReturns the current transaction isolation level.Returns:
the isolation level.
Throws:
SQLException - if the connection is closed
Map getTypeMap() throws SQLExceptionGets the type map.Returns:
null
Throws:
SQLException - if the connection is closed
SQLWarning getWarnings() throws SQLExceptionGets the first warning reported by calls on this object.Returns:
null
boolean isClosed() throws SQLExceptionReturns true if this connection has been closed.Returns:
true if close was called
boolean isReadOnly() throws SQLExceptionReturns true if the database is read-only.Returns:
if the database is read-only
Throws:
SQLException - if the connection is closed
boolean isValid(int timeout)Returns true if this connection is still valid.Returns:
true if the connection is valid.
String nativeSQL(String sql) throws SQLExceptionTranslates a SQL statement into the database grammar.Returns:
the translated statement
Throws:
SQLException - if the connection is closed
CallableStatement prepareCall(String sql) throws SQLExceptionCreates a new callable statement.Returns:
the callable statement
Throws:
SQLException - if the connection is closed or the statement is not valid
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLExceptionCreates a callable statement with the specified result set type and concurrency.Returns:
the callable statement
Throws:
SQLException - if the connection is closed or the result set type or
concurrency are not supported
CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionCreates a callable statement with the specified result set type, concurrency, and holdability.Returns:
the callable statement
Throws:
SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supported
PreparedStatement prepareStatement(String sql) throws SQLExceptionCreates a new prepared statement.Returns:
the prepared statement
Throws:
SQLException - if the connection is closed
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLExceptionCreates a prepared statement with the specified result set type and concurrency.Returns:
the prepared statement
Throws:
SQLException - if the connection is closed or the result set type or
concurrency are not supported
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLExceptionCreates a prepared statement with the specified result set type, concurrency, and holdability.Returns:
the prepared statement
Throws:
SQLException - if the connection is closed or the result set type,
concurrency, or holdability are not supported
PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLExceptionCreates a new prepared statement. This method just calls prepareStatement(String sql).Returns:
the prepared statement
Throws:
SQLException - if the connection is closed
PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLExceptionCreates a new prepared statement. This method just calls prepareStatement(String sql).Returns:
the prepared statement
Throws:
SQLException - if the connection is closed
PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLExceptionCreates a new prepared statement. This method just calls prepareStatement(String sql).Returns:
the prepared statement
Throws:
SQLException - if the connection is closed
void releaseSavepoint(Savepoint savepoint) throws SQLExceptionReleases a savepoint.void rollback() throws SQLExceptionRolls back the current transaction. This call has only an effect if auto commit is switched off.Throws:
SQLException - if the connection is closed
void rollback(Savepoint savepoint) throws SQLExceptionRolls back to a savepoint.void setAutoCommit(boolean autoCommit) throws SQLExceptionSwitches auto commit on or off. Calling this function does not commit the current transaction.Parameters:
autoCommit - true for auto commit on, false for off
Throws:
SQLException - if the connection is closed
void setCatalog(String catalog) throws SQLExceptionSet the default catalog name. This call is ignored.Throws:
SQLException - if the connection is closed
void setHoldability(int holdability) throws SQLExceptionChanges the current result set holdability.Parameters:
holdability - ResultSet.HOLD_CURSORS_OVER_COMMIT or
ResultSet.CLOSE_CURSORS_AT_COMMIT;
Throws:
SQLException - if the connection is closed or the holdability is not
supported
void setReadOnly(boolean readOnly) throws SQLExceptionAccording to the JDBC specs, this setting is only a hint to the database to enable optimizations - it does not cause writes to be prohibited.Throws:
SQLException - if the connection is closed
Savepoint setSavepoint() throws SQLExceptionCreates a new unnamed savepoint.Returns:
the new savepoint
Savepoint setSavepoint(String name) throws SQLExceptionCreates a new named savepoint.Returns:
the new savepoint
void setTransactionIsolation(int level) throws SQLExceptionChanges the current transaction isolation level. Calling this method will commit an open transaction, even if the new level is the same as the old one, except if the level is not supported. Internally, this method calls SET LOCK_MODE. The following isolation levels are supported:
Parameters:
level - the new transaction isolation level:
Connection.TRANSACTION_READ_UNCOMMITTED,
Connection.TRANSACTION_READ_COMMITTED, or
Connection.TRANSACTION_SERIALIZABLE
Throws:
SQLException - if the connection is closed or the isolation level
is not supported
void setTypeMap(Map map) throws SQLException[Partially supported] Sets the type map. This is only supported if the map is empty or null. |