Connection (Java Platform SE 7 ) (original) (raw)
Modifier and Type
Method and Description
void
**[abort](../../java/sql/Connection.html#abort%28java.util.concurrent.Executor%29)**([Executor](../../java/util/concurrent/Executor.html "interface in java.util.concurrent") executor)
Terminates an open connection.
void
**[clearWarnings](../../java/sql/Connection.html#clearWarnings%28%29)**()
Clears all warnings reported for this Connection
object.
void
**[close](../../java/sql/Connection.html#close%28%29)**()
Releases this Connection
object's database and JDBC resources immediately instead of waiting for them to be automatically released.
void
**[commit](../../java/sql/Connection.html#commit%28%29)**()
Makes all changes made since the previous commit/rollback permanent and releases any database locks currently held by this Connection
object.
[Array](../../java/sql/Array.html "interface in java.sql")
**[createArrayOf](../../java/sql/Connection.html#createArrayOf%28java.lang.String,%20java.lang.Object[]%29)**([String](../../java/lang/String.html "class in java.lang") typeName,[Object](../../java/lang/Object.html "class in java.lang")[] elements)
Factory method for creating Array objects.
[Blob](../../java/sql/Blob.html "interface in java.sql")
**[createBlob](../../java/sql/Connection.html#createBlob%28%29)**()
Constructs an object that implements the Blob
interface.
[Clob](../../java/sql/Clob.html "interface in java.sql")
**[createClob](../../java/sql/Connection.html#createClob%28%29)**()
Constructs an object that implements the Clob
interface.
[NClob](../../java/sql/NClob.html "interface in java.sql")
**[createNClob](../../java/sql/Connection.html#createNClob%28%29)**()
Constructs an object that implements the NClob
interface.
[SQLXML](../../java/sql/SQLXML.html "interface in java.sql")
**[createSQLXML](../../java/sql/Connection.html#createSQLXML%28%29)**()
Constructs an object that implements the SQLXML
interface.
[Statement](../../java/sql/Statement.html "interface in java.sql")
**[createStatement](../../java/sql/Connection.html#createStatement%28%29)**()
Creates a Statement
object for sending SQL statements to the database.
[Statement](../../java/sql/Statement.html "interface in java.sql")
**[createStatement](../../java/sql/Connection.html#createStatement%28int,%20int%29)**(int resultSetType, int resultSetConcurrency)
Creates a Statement
object that will generateResultSet
objects with the given type and concurrency.
[Statement](../../java/sql/Statement.html "interface in java.sql")
**[createStatement](../../java/sql/Connection.html#createStatement%28int,%20int,%20int%29)**(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Creates a Statement
object that will generateResultSet
objects with the given type, concurrency, and holdability.
[Struct](../../java/sql/Struct.html "interface in java.sql")
**[createStruct](../../java/sql/Connection.html#createStruct%28java.lang.String,%20java.lang.Object[]%29)**([String](../../java/lang/String.html "class in java.lang") typeName,[Object](../../java/lang/Object.html "class in java.lang")[] attributes)
Factory method for creating Struct objects.
boolean
**[getAutoCommit](../../java/sql/Connection.html#getAutoCommit%28%29)**()
Retrieves the current auto-commit mode for this Connection
object.
[String](../../java/lang/String.html "class in java.lang")
**[getCatalog](../../java/sql/Connection.html#getCatalog%28%29)**()
Retrieves this Connection
object's current catalog name.
[Properties](../../java/util/Properties.html "class in java.util")
**[getClientInfo](../../java/sql/Connection.html#getClientInfo%28%29)**()
Returns a list containing the name and current value of each client info property supported by the driver.
[String](../../java/lang/String.html "class in java.lang")
**[getClientInfo](../../java/sql/Connection.html#getClientInfo%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") name)
Returns the value of the client info property specified by name.
int
**[getHoldability](../../java/sql/Connection.html#getHoldability%28%29)**()
Retrieves the current holdability of ResultSet
objects created using this Connection
object.
[DatabaseMetaData](../../java/sql/DatabaseMetaData.html "interface in java.sql")
**[getMetaData](../../java/sql/Connection.html#getMetaData%28%29)**()
Retrieves a DatabaseMetaData
object that contains metadata about the database to which thisConnection
object represents a connection.
int
**[getNetworkTimeout](../../java/sql/Connection.html#getNetworkTimeout%28%29)**()
Retrieves the number of milliseconds the driver will wait for a database request to complete.
[String](../../java/lang/String.html "class in java.lang")
**[getSchema](../../java/sql/Connection.html#getSchema%28%29)**()
Retrieves this Connection
object's current schema name.
int
**[getTransactionIsolation](../../java/sql/Connection.html#getTransactionIsolation%28%29)**()
Retrieves this Connection
object's current transaction isolation level.
[Map](../../java/util/Map.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang"),[Class](../../java/lang/Class.html "class in java.lang")<?>>
**[getTypeMap](../../java/sql/Connection.html#getTypeMap%28%29)**()
Retrieves the Map
object associated with thisConnection
object.
[SQLWarning](../../java/sql/SQLWarning.html "class in java.sql")
**[getWarnings](../../java/sql/Connection.html#getWarnings%28%29)**()
Retrieves the first warning reported by calls on thisConnection
object.
boolean
**[isClosed](../../java/sql/Connection.html#isClosed%28%29)**()
Retrieves whether this Connection
object has been closed.
boolean
**[isReadOnly](../../java/sql/Connection.html#isReadOnly%28%29)**()
Retrieves whether this Connection
object is in read-only mode.
boolean
**[isValid](../../java/sql/Connection.html#isValid%28int%29)**(int timeout)
Returns true if the connection has not been closed and is still valid.
[String](../../java/lang/String.html "class in java.lang")
**[nativeSQL](../../java/sql/Connection.html#nativeSQL%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") sql)
Converts the given SQL statement into the system's native SQL grammar.
[CallableStatement](../../java/sql/CallableStatement.html "interface in java.sql")
**[prepareCall](../../java/sql/Connection.html#prepareCall%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") sql)
Creates a CallableStatement
object for calling database stored procedures.
[CallableStatement](../../java/sql/CallableStatement.html "interface in java.sql")
**[prepareCall](../../java/sql/Connection.html#prepareCall%28java.lang.String,%20int,%20int%29)**([String](../../java/lang/String.html "class in java.lang") sql, int resultSetType, int resultSetConcurrency)
Creates a CallableStatement
object that will generateResultSet
objects with the given type and concurrency.
[CallableStatement](../../java/sql/CallableStatement.html "interface in java.sql")
**[prepareCall](../../java/sql/Connection.html#prepareCall%28java.lang.String,%20int,%20int,%20int%29)**([String](../../java/lang/String.html "class in java.lang") sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Creates a CallableStatement
object that will generateResultSet
objects with the given type and concurrency.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") sql)
Creates a PreparedStatement
object for sending parameterized SQL statements to the database.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String,%20int%29)**([String](../../java/lang/String.html "class in java.lang") sql, int autoGeneratedKeys)
Creates a default PreparedStatement
object that has the capability to retrieve auto-generated keys.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String,%20int[]%29)**([String](../../java/lang/String.html "class in java.lang") sql, int[] columnIndexes)
Creates a default PreparedStatement
object capable of returning the auto-generated keys designated by the given array.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String,%20int,%20int%29)**([String](../../java/lang/String.html "class in java.lang") sql, int resultSetType, int resultSetConcurrency)
Creates a PreparedStatement
object that will generateResultSet
objects with the given type and concurrency.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String,%20int,%20int,%20int%29)**([String](../../java/lang/String.html "class in java.lang") sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)
Creates a PreparedStatement
object that will generateResultSet
objects with the given type, concurrency, and holdability.
[PreparedStatement](../../java/sql/PreparedStatement.html "interface in java.sql")
**[prepareStatement](../../java/sql/Connection.html#prepareStatement%28java.lang.String,%20java.lang.String[]%29)**([String](../../java/lang/String.html "class in java.lang") sql,[String](../../java/lang/String.html "class in java.lang")[] columnNames)
Creates a default PreparedStatement
object capable of returning the auto-generated keys designated by the given array.
void
**[releaseSavepoint](../../java/sql/Connection.html#releaseSavepoint%28java.sql.Savepoint%29)**([Savepoint](../../java/sql/Savepoint.html "interface in java.sql") savepoint)
Removes the specified Savepoint
and subsequent Savepoint
objects from the current transaction.
void
**[rollback](../../java/sql/Connection.html#rollback%28%29)**()
Undoes all changes made in the current transaction and releases any database locks currently held by this Connection
object.
void
**[rollback](../../java/sql/Connection.html#rollback%28java.sql.Savepoint%29)**([Savepoint](../../java/sql/Savepoint.html "interface in java.sql") savepoint)
Undoes all changes made after the given Savepoint
object was set.
void
**[setAutoCommit](../../java/sql/Connection.html#setAutoCommit%28boolean%29)**(boolean autoCommit)
Sets this connection's auto-commit mode to the given state.
void
**[setCatalog](../../java/sql/Connection.html#setCatalog%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") catalog)
Sets the given catalog name in order to select a subspace of this Connection
object's database in which to work.
void
**[setClientInfo](../../java/sql/Connection.html#setClientInfo%28java.util.Properties%29)**([Properties](../../java/util/Properties.html "class in java.util") properties)
Sets the value of the connection's client info properties.
void
**[setClientInfo](../../java/sql/Connection.html#setClientInfo%28java.lang.String,%20java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") name,[String](../../java/lang/String.html "class in java.lang") value)
Sets the value of the client info property specified by name to the value specified by value.
void
**[setHoldability](../../java/sql/Connection.html#setHoldability%28int%29)**(int holdability)
Changes the default holdability of ResultSet
objects created using this Connection
object to the given holdability.
void
**[setNetworkTimeout](../../java/sql/Connection.html#setNetworkTimeout%28java.util.concurrent.Executor,%20int%29)**([Executor](../../java/util/concurrent/Executor.html "interface in java.util.concurrent") executor, int milliseconds)
Sets the maximum period a Connection
or objects created from the Connection
will wait for the database to reply to any one request.
void
**[setReadOnly](../../java/sql/Connection.html#setReadOnly%28boolean%29)**(boolean readOnly)
Puts this connection in read-only mode as a hint to the driver to enable database optimizations.
[Savepoint](../../java/sql/Savepoint.html "interface in java.sql")
**[setSavepoint](../../java/sql/Connection.html#setSavepoint%28%29)**()
Creates an unnamed savepoint in the current transaction and returns the new Savepoint
object that represents it.
[Savepoint](../../java/sql/Savepoint.html "interface in java.sql")
**[setSavepoint](../../java/sql/Connection.html#setSavepoint%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") name)
Creates a savepoint with the given name in the current transaction and returns the new Savepoint
object that represents it.
void
**[setSchema](../../java/sql/Connection.html#setSchema%28java.lang.String%29)**([String](../../java/lang/String.html "class in java.lang") schema)
Sets the given schema name to access.
void
**[setTransactionIsolation](../../java/sql/Connection.html#setTransactionIsolation%28int%29)**(int level)
Attempts to change the transaction isolation level for thisConnection
object to the one given.
void
**[setTypeMap](../../java/sql/Connection.html#setTypeMap%28java.util.Map%29)**([Map](../../java/util/Map.html "interface in java.util")<[String](../../java/lang/String.html "class in java.lang"),[Class](../../java/lang/Class.html "class in java.lang")<?>> map)
Installs the given TypeMap
object as the type map for this Connection
object.