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

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.

主站蜘蛛池模板: 剑川县| 休宁县| 青铜峡市| 镶黄旗| 商河县| 筠连县| 嘉义县| 南郑县| 称多县| 定日县| 平原县| 扬中市| 台湾省| 文安县| 清镇市| 韶山市| 棋牌| 安岳县| 安塞县| 美姑县| 萍乡市| 北海市| 横山县| 永修县| 高雄县| 托里县| 沂南县| 焦作市| 满洲里市| 泰安市| 东阿县| 米泉市| 连江县| 微博| 平潭县| 石楼县| 常德市| 迁西县| 温州市| 灵丘县| 霍城县|