java.sql.Connection

2023-07-26 02:47:17  Updated

java.sql.Connection is a database connection interface.

Description

java.sql.Connection establishes a connection to a specified database. SQL statements are executed and results are returned in the connection.

The connected database can provide description information such as tables, supported SQL syntax, stored procedures, and connection features. The information can be obtained by using the getMetaData() method.

By default, a Connection object is in auto-commit mode. In other words, it automatically commits changes after each statement is executed. If the auto-commit mode is disabled, you must explicitly call the commit method to commit the changes; otherwise, the changes to the database are not saved.

Methods

Method Return type JDBC 4 supported in Oracle mode JDBC 4 supported in MySQL mode
close() void Yes Yes
commit() void Yes Yes
createStatement() Statement Yes Yes
getAutoCommit() Boolen Yes Yes
getMetaData() DatabaseMetaData Yes Yes
getClientInfo() Properties Yes Yes
getClientInfo(String name) Properties Yes Yes
getTransactionIsolation() int Yes Yes
isClosed() Boolean Yes Yes
isReadOnly() Boolean Yes Yes
prepareStatement(String sql) PreparedStatement Yes Yes
prepareCall(String sql) Statement Yes Yes
rollback() void Yes Yes
rollback(Savepoint savepoint) void Yes Yes
setAutoCommit(boolean autoCommit) void Yes Yes
setClientInfo(Properties properties) void Yes Yes
setClientInfo(String name,String value) void Yes Yes
createStruct(String typeName, Object[] attributes) Struct Yes Yes
abort(Executor executor) void Yes Yes
getNetworkTimeout() int Yes Yes
getSchema() String Yes Yes
setSchema(String schema) void Yes Yes
setNetworkTimeout(Executor executor, int milliseconds) void Yes Yes

Contact Us