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

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.

主站蜘蛛池模板: 四子王旗| 宁陕县| 峨眉山市| 本溪| 富蕴县| 仲巴县| 台前县| 池州市| 基隆市| 抚宁县| 黑水县| 泌阳县| 龙井市| 和田市| 二手房| 长岛县| 阜康市| 西乌珠穆沁旗| 平湖市| 丹巴县| 九龙坡区| 沽源县| 瑞安市| 株洲市| 仲巴县| 台湾省| 衡阳县| 内乡县| 富平县| 孟连| 阿荣旗| 平原县| 白玉县| 黄冈市| 德昌县| 会昌县| 寿光市| 晋中市| 屯留县| 南郑县| 华容县|