JDBCによるトランザクション処理の基礎 まず、基本的なトランザクション処理の実装例を見ていきましょう。上記で説明した原子性を実現するためには、下記(コード1)のようにtry~catch処理を書くことになります。 Connection connect = null; Statement stmt = null; try { // JDBCドライバをロード Class.forName("oracle.jdbc.driver.OracleDriver"); // DB接続オブジェクト connect = DriverManager.getConnection("jdbc:oracle:thin:~", "scott", "tiger"); // 自動コミット解除 …… 【1】 connect.setAutoCommit(false); // ステートメントを作成 stmt = connect.
