官术网_书友最值得收藏!

Connection Interface

The Connection interface represents a connection with the database. SQL statements may be run in a connection session by using a Statement object. A Connection object is in auto-commit mode, by default. In the auto-commit mode, changes are committed to the database after an SQL statement is executed. The auto-commit mode can be modified by calling the setAutoCommit(boolean autoCommit) method. For example, auto-commit may be set to false :

connection.setAutoCommit(false);

If auto-commit is set to false, it would be required to commit changes by calling the commit() method:

connection.commit();

A Connection object can be set to read-only by calling the setReadOnly() method:

connection.setReadOnly(true);

If a Connection object is not required, close the connection by calling the close() method:

connection.close();

The following table discusses the methods in JDBC 4.0 that have been added to the Connection interface.

主站蜘蛛池模板: 资兴市| 广安市| 岢岚县| 南京市| 河津市| 兰坪| 涪陵区| 上虞市| 高雄县| 乐安县| 平陆县| 五大连池市| 海城市| 凤庆县| 杭锦后旗| 抚远县| 宁乡县| 绥宁县| 西畴县| 永德县| 施甸县| 怀来县| 分宜县| 武冈市| 洪江市| 浙江省| 嘉峪关市| 古浪县| 瓦房店市| 左权县| 阜康市| 教育| 江川县| 旺苍县| 云浮市| 涡阳县| 栾城县| 西畴县| 五原县| 石柱| 遂平县|