Fields
- ✓public static final int TRANSACTION_NONE = 0
- ✓public static final int TRANSACTION_READ_COMMITTED = 2
- ✓public static final int TRANSACTION_READ_UNCOMMITTED = 1
- ✓public static final int TRANSACTION_REPEATABLE_READ = 4
- ✓public static final int TRANSACTION_SERIALIZABLE = 8
Methods
- ✗public abstract void abort(java.util.concurrent.Executor arg0) throws java.sql.SQLExceptionComparing jdbc-MR4.4 and jdbc-MR4.3
Moved out of an unordered list with class tag-list-long.Moved to an unordered list with class tag-list.abort
Terminates an open connection. Callingabort
results in:- The connection marked as closed
- Closes any physical connection to the database
- Releases resources used by the connection
- Insures that any thread that is currently accessing the connection will either progress to completion or throw an
SQLException
.
Calling
abort
marks the connection closed and releases any resources. Callingabort
on a closed connection is a no-op.It is possible that the aborting and releasing of the resources that are held by the connection can take an extended period of time. When the
abort
method returns, the connection will have been marked as closed and theExecutor
that was passed as a parameter to abort may still be executing tasks to release resources.This method checks to see that there is an
SQLPermission
object before allowing the method to proceed. If aSecurityManager
exists and itscheckPermission
method denies callingabort
, this method throws ajava.lang.SecurityException
.- Parameters:
executor
- TheExecutor
implementation which will be used byabort
.- Throws:
SQLException
- if a database access error occurs or theexecutor
isnull
,SecurityException
- if a security manager exists and itscheckPermission
method denies callingabort
- Since:
- 1.7
- See Also:
SecurityManager.checkPermission(java.security.Permission)
Moved out of an unordered list with class tag-list-long.Moved to an unordered list with class tag-list.
- ✓public default void beginRequest() throws java.sql.SQLException
- ✓public abstract void clearWarnings() throws java.sql.SQLException
- ✓public abstract void close() throws java.sql.SQLException
- ✓public abstract void commit() throws java.sql.SQLException
- ✓public abstract java.sql.Array createArrayOf(java.lang.String arg0, java.lang.Object[] arg1) throws java.sql.SQLException
- ✓public abstract java.sql.Blob createBlob() throws java.sql.SQLException
- ✓public abstract java.sql.Clob createClob() throws java.sql.SQLException
- ✓public abstract java.sql.NClob createNClob() throws java.sql.SQLException
- ✓public abstract java.sql.SQLXML createSQLXML() throws java.sql.SQLException
- ✓public abstract java.sql.Statement createStatement() throws java.sql.SQLException
- ✓public abstract java.sql.Statement createStatement(int arg0, int arg1) throws java.sql.SQLException
- ✓public abstract java.sql.Statement createStatement(int arg0, int arg1, int arg2) throws java.sql.SQLException
- ✓public abstract java.sql.Struct createStruct(java.lang.String arg0, java.lang.Object[] arg1) throws java.sql.SQLException
- ✓public default void endRequest() throws java.sql.SQLException
- ✓public abstract boolean getAutoCommit() throws java.sql.SQLException
- ✓public abstract java.lang.String getCatalog() throws java.sql.SQLException
- ✓public abstract java.util.Properties getClientInfo() throws java.sql.SQLException
- ✓public abstract java.lang.String getClientInfo(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract int getHoldability() throws java.sql.SQLException
- ✓public abstract java.sql.DatabaseMetaData getMetaData() throws java.sql.SQLException
- ✓public abstract int getNetworkTimeout() throws java.sql.SQLException
- ✓public abstract java.lang.String getSchema() throws java.sql.SQLException
- ✓public abstract int getTransactionIsolation() throws java.sql.SQLException
- ✓public abstract java.util.Map<java.lang.String, java.lang.Class<?>> getTypeMap() throws java.sql.SQLException
- ✓public abstract java.sql.SQLWarning getWarnings() throws java.sql.SQLException
- ✓public abstract boolean isClosed() throws java.sql.SQLException
- ✓public abstract boolean isReadOnly() throws java.sql.SQLException
- ✓public abstract boolean isValid(int arg0) throws java.sql.SQLException
- ✓public abstract java.lang.String nativeSQL(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract java.sql.CallableStatement prepareCall(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract java.sql.CallableStatement prepareCall(java.lang.String arg0, int arg1, int arg2) throws java.sql.SQLException
- ✓public abstract java.sql.CallableStatement prepareCall(java.lang.String arg0, int arg1, int arg2, int arg3) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int arg1) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int arg1, int arg2) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int arg1, int arg2, int arg3) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0, int[] arg1) throws java.sql.SQLException
- ✓public abstract java.sql.PreparedStatement prepareStatement(java.lang.String arg0, java.lang.String[] arg1) throws java.sql.SQLException
- ✓public abstract void releaseSavepoint(java.sql.Savepoint arg0) throws java.sql.SQLException
- ✓public abstract void rollback() throws java.sql.SQLException
- ✓public abstract void rollback(java.sql.Savepoint arg0) throws java.sql.SQLException
- ✓public abstract void setAutoCommit(boolean arg0) throws java.sql.SQLException
- ✓public abstract void setCatalog(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract void setClientInfo(java.lang.String arg0, java.lang.String arg1) throws java.sql.SQLClientInfoException
- ✓public abstract void setClientInfo(java.util.Properties arg0) throws java.sql.SQLClientInfoException
- ✓public abstract void setHoldability(int arg0) throws java.sql.SQLException
- ✗public abstract void setNetworkTimeout(java.util.concurrent.Executor arg0, int arg1) throws java.sql.SQLExceptionComparing jdbc-MR4.4 and jdbc-MR4.3
setNetworkTimeout
Sets the maximum period aConnection
or objects created from theConnection
will wait for the database to reply to any one request. If any request remains unanswered, the waiting method will return with aSQLException
, and theConnection
or objects created from theConnection
will be marked as closed. Any subsequent use of the objects, with the exception of theclose
,isClosed
orConnection.isValid
methods, will result in aSQLException
.Note: This method is intended to address a rare but serious condition where network partitions can cause threads issuing JDBC calls to hang uninterruptedly in socket reads, until the OS TCP-TIMEOUT (typically 10 minutes). This method is related to the
abort()
method which provides an administrator thread a means to free any such threads in cases where the JDBC connection is accessible to the administrator thread. ThesetNetworkTimeout
method will cover cases where there is no administrator thread, or it has no access to the connection. This method is severe in it's effects, and should be given a high enough value so it is never triggered before any more normal timeouts, such as transaction timeouts.JDBC driver implementations may also choose to support the
setNetworkTimeout
method to impose a limit on database response time, in environments where no network is present.Drivers may internally implement some or all of their API calls with multiple internal driver-database transmissions, and it is left to the driver implementation to determine whether the limit will be applied always to the response to the API call, or to any single request made during the API call.
This method can be invoked more than once, such as to set a limit for an area of JDBC code, and to reset to the default on exit from this area. Invocation of this method has no impact on already outstanding requests.
The
Statement.setQueryTimeout()
timeout value is independent of the timeout value specified insetNetworkTimeout
. If the query timeout expires before the network timeout then the statement execution will be canceled. If the network is still active the result will be that both the statement and connection are still usable. However if the network timeout expires before the query timeout or if the statement timeout fails due to network problems, the connection will be marked as closed, any resources held by the connection will be released and both the connection and statement will be unusable.When the driver determines that the
setNetworkTimeout
timeout value has expired, the JDBC driver marks the connection closed and releases any resources held by the connection.This method checks to see that there is an
SQLPermission
object before allowing the method to proceed. If aSecurityManager
exists and itscheckPermission
method denies callingsetNetworkTimeout
, this method throws ajava.lang.SecurityException
.- Parameters:
executor
- TheExecutor
implementation which will be used bysetNetworkTimeout
.milliseconds
- The time in milliseconds to wait for the database operation to complete. If the JDBC driver does not support milliseconds, the JDBC driver will round the value up to the nearest second. If the timeout period expires before the operation completes, a SQLException will be thrown. A value of 0 indicates that there is not timeout for database operations.- Throws:
SQLException
- if a database access error occurs, this method is called on a closed connection, theexecutor
isnull
, or the value specified forseconds
is less than 0.SecurityException
- if a security manager exists and itscheckPermission
method denies callingsetNetworkTimeout
.SQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.7
- See Also:
- ✓public abstract void setReadOnly(boolean arg0) throws java.sql.SQLException
- ✓public abstract java.sql.Savepoint setSavepoint() throws java.sql.SQLException
- ✓public abstract java.sql.Savepoint setSavepoint(java.lang.String arg0) throws java.sql.SQLException
- ✓public abstract void setSchema(java.lang.String arg0) throws java.sql.SQLException
- ✓public default void setShardingKey(java.sql.ShardingKey arg0) throws java.sql.SQLException
- ✓public default void setShardingKey(java.sql.ShardingKey arg0, java.sql.ShardingKey arg1) throws java.sql.SQLException
- ✓public default boolean setShardingKeyIfValid(java.sql.ShardingKey arg0, int arg1) throws java.sql.SQLException
- ✓public default boolean setShardingKeyIfValid(java.sql.ShardingKey arg0, java.sql.ShardingKey arg1, int arg2) throws java.sql.SQLException
- ✓public abstract void setTransactionIsolation(int arg0) throws java.sql.SQLException
- ✓public abstract void setTypeMap(java.util.Map<java.lang.String, java.lang.Class<?>> arg0) throws java.sql.SQLException
Summary
Elements | Comments | Descriptions | Total | |||||||
---|---|---|---|---|---|---|---|---|---|---|
Added | Changed | Removed | Added | Changed | Removed | Added | Changed | Removed | ||
abort(Executor) | 6 | 10 | 16 | |||||||
setNetworkTimeout(Executor,int) | 9 | 9 | ||||||||
Total | 6 | 19 | 25 |