Connection (Java SE 25 & JDK 25)
- All Superinterfaces:
AutoCloseable, Wrapper
-
Field Summary
Fields
static final intA constant indicating that transactions are not supported.
static final intA constant indicating that dirty reads are prevented; non-repeatable reads and phantom reads can occur.
static final intA constant indicating that dirty reads, non-repeatable reads and phantom reads can occur.
static final intA constant indicating that dirty reads and non-repeatable reads are prevented; phantom reads can occur.
static final intA constant indicating that dirty reads, non-repeatable reads and phantom reads are prevented.
-
Method Summary
voidTerminates an open connection.
default voidHints to the driver that a request, an independent unit of work, is beginning on this connection.
voidClears all warnings reported for this
Connectionobject.voidclose()Releases this
Connectionobject's database and JDBC resources immediately instead of waiting for them to be automatically released.voidcommit()Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this
Connectionobject.Factory method for creating Array objects.
Constructs an object that implements the
Blobinterface.Constructs an object that implements the
Clobinterface.Constructs an object that implements the
NClobinterface.Constructs an object that implements the
SQLXMLinterface.Creates a
Statementobject for sending SQL statements to the database.createStatement(int resultSetType, int resultSetConcurrency) Creates a
Statementobject that will generateResultSetobjects with the given type and concurrency.createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a
Statementobject that will generateResultSetobjects with the given type, concurrency, and holdability.Factory method for creating Struct objects.
default voidHints to the driver that a request, an independent unit of work, has completed.
booleanRetrieves the current auto-commit mode for this
Connectionobject.Retrieves this
Connectionobject's current catalog name.Returns a list containing the name and current value of each client info property supported by the driver.
Returns the value of the client info property specified by name.
intRetrieves the current holdability of
ResultSetobjects created using thisConnectionobject.Retrieves a
DatabaseMetaDataobject that contains metadata about the database to which thisConnectionobject represents a connection.intRetrieves the number of milliseconds the driver will wait for a database request to complete.
Retrieves this
Connectionobject's current schema name.intRetrieves this
Connectionobject's current transaction isolation level.Retrieves the
Mapobject associated with thisConnectionobject.Retrieves the first warning reported by calls on this
Connectionobject.booleanisClosed()Retrieves whether this
Connectionobject has been closed.booleanRetrieves whether this
Connectionobject is in read-only mode.booleanisValid(int timeout) Returns true if the connection has not been closed and is still valid.
Converts the given SQL statement into the system's native SQL grammar.
Creates a
CallableStatementobject for calling database stored procedures.prepareCall(String sql, int resultSetType, int resultSetConcurrency) Creates a
CallableStatementobject that will generateResultSetobjects with the given type and concurrency.prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a
CallableStatementobject that will generateResultSetobjects with the given type and concurrency.Creates a
PreparedStatementobject for sending parameterized SQL statements to the database.prepareStatement(String sql, int autoGeneratedKeys) Creates a default
PreparedStatementobject that has the capability to retrieve auto-generated keys.prepareStatement(String sql, int[] columnIndexes) Creates a default
PreparedStatementobject capable of returning the auto-generated keys designated by the given array.prepareStatement(String sql, int resultSetType, int resultSetConcurrency) Creates a
PreparedStatementobject that will generateResultSetobjects with the given type and concurrency.prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) Creates a
PreparedStatementobject that will generateResultSetobjects with the given type, concurrency, and holdability.Creates a default
PreparedStatementobject capable of returning the auto-generated keys designated by the given array.voidRemoves the specified
Savepointand subsequentSavepointobjects from the current transaction.voidrollback()Undoes all changes made in the current transaction and releases any database locks currently held by this
Connectionobject.voidUndoes all changes made after the given
Savepointobject was set.voidsetAutoCommit(boolean autoCommit) Sets this connection's auto-commit mode to the given state.
voidSets the given catalog name in order to select a subspace of this
Connectionobject's database in which to work.voidSets the value of the client info property specified by name to the value specified by value.
voidSets the value of the connection's client info properties.
voidsetHoldability(int holdability) Changes the default holdability of
ResultSetobjects created using thisConnectionobject to the given holdability.voidsetNetworkTimeout(Executor executor, int milliseconds) Sets the maximum period a
Connectionor objects created from theConnectionwill wait for the database to reply to any one request.voidsetReadOnly(boolean readOnly) Puts this connection in read-only mode as a hint to the driver to enable database optimizations.
Creates an unnamed savepoint in the current transaction and returns the new
Savepointobject that represents it.Creates a savepoint with the given name in the current transaction and returns the new
Savepointobject that represents it.voidSets the given schema name to access.
default voidSpecifies a shardingKey to use with this Connection
default voidSpecifies a shardingKey and superShardingKey to use with this Connection
default booleanSets and validates the sharding key for this connection.
default booleanSets and validates the sharding keys for this connection.
voidsetTransactionIsolation(int level) Attempts to change the transaction isolation level for this
Connectionobject to the one given.voidInstalls the given
TypeMapobject as the type map for thisConnectionobject.
-
Field Details
-
TRANSACTION_NONE
-
TRANSACTION_READ_UNCOMMITTED
-
TRANSACTION_READ_COMMITTED
-
TRANSACTION_REPEATABLE_READ
-
TRANSACTION_SERIALIZABLE
-
-
Method Details
-
createStatement
-
prepareStatement
-
prepareCall
-
nativeSQL
-
setAutoCommit
-
getAutoCommit
-
commit
-
rollback
-
close
-
isClosed
-
getMetaData
-
setReadOnly
-
isReadOnly
-
setCatalog
-
getCatalog
-
setTransactionIsolation
-
getTransactionIsolation
-
getWarnings
-
clearWarnings
-
createStatement
-
prepareStatement
-
prepareCall
-
getTypeMap
-
setTypeMap
-
setHoldability
-
getHoldability
-
setSavepoint
-
setSavepoint
-
rollback
-
releaseSavepoint
-
createStatement
-
prepareStatement
-
prepareCall
-
prepareStatement
-
prepareStatement
-
prepareStatement
-
createClob
-
createBlob
-
createNClob
-
createSQLXML
-
isValid
-
setClientInfo
-
setClientInfo
-
getClientInfo
-
getClientInfo
-
createArrayOf
-
createStruct
-
setSchema
-
getSchema
-
abort
-
setNetworkTimeout
-
getNetworkTimeout
-
beginRequest
-
endRequest
-
setShardingKeyIfValid
-
setShardingKeyIfValid
-
setShardingKey
-
setShardingKey
-