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

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.

主站蜘蛛池模板: 沛县| 同德县| 黑龙江省| 泰来县| 阳朔县| 兴文县| 德格县| 察雅县| 衡东县| 阳信县| 嘉善县| 拜泉县| 宜兰市| 阳新县| 信丰县| 庄河市| 革吉县| 道孚县| 新化县| 阿城市| 永寿县| 竹山县| 彭水| 个旧市| 通州市| 新化县| 赤水市| 温州市| 海门市| 胶州市| 刚察县| 吉首市| 蓬安县| 通榆县| 临清市| 焉耆| 枝江市| 聂荣县| 左云县| 浦东新区| 柳江县|