Connection Methods
The connection methods require a valid connection, returned from the getConnection() method.
clearWarnings
connection.clearWarnings()
Clears all warnings for the connection, returning a void.
close
connection.close()
Closes the database connection and frees all connection resources, returning a void.
commit
connection.commit()
Commits open transactions.
createStatement
connection.createStatement([int resultSetType, int resultSetConcurrency])
Returns a Statement object, which is a mechanism for passing queries to the database, and receives results back, through its connection object. With the optional arguments, the generated ResultSet objects will have the specified type and concurrency.
getAutoCommit
connection.getAutoCommit()
Returns true if AutoCommit mode is set for the connection and false if it is not.
getMetaData
connection.getMetaData()
Returns a database metadata object containing metadata about the database with which the connection has been made.
getTransactionIsolation
connection.getTransactionIsolation()
Returns an integer containing the transaction isolation level for the connection. The transaction isolation levels can be one of the following: TRANSACTION_READ_ UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE, or TRANSACTION_NONE.
getTypeMap
connection.getTypeMap
Returns a Map object associated with the connection.
isClosed
connection.isClosed()
Returns true if the connection has been closed and false if it's still open.
isReadOnly
connection.isReadOnly()
Returns true if the connection is read only and false if not.
nativeSQL
connection.nativeSQL(String sql)
Returns a string with the supplied string converted to the system's native SQL.
prepareStatement
connection.prepareStatement(String sql)
Prepares the statement to be sent to the database, which means you can make use of placeholders (or parameters). Use the setInt() and setString() methods to set the values of the parameters.
rollback
connection.rollback()
Undoes all changes in the current transaction.
setAutoCommit
connection.setAutoCommit(boolean mode)
Sets the connection's AutoCommit mode (true if set, false if not).
setReadOnly
connection.setReadOnly(boolean mode)
Passing the method true sets the connection to read-only mode.
setTransactionIsolation
connection.setTransactionIsolation(int level)
The level can be one of the following: connection.TRANSACTION_READ_UNCOMMITTED, connection.TRANSACTION_READ_COMMITTED, connection.TRANSACTION_REPEATABLE_READ, or connection.TRANSACTION_SERIALIZABLE.
setTypeMap
connection.setTypeMap(Map map)
Sets the type Map object for the connection.