Skip to content

Commit 5e770b6

Browse files
committed
Disable JDBC auto-commit on new connections
Oracle JDBC enforces JDBC 4.1 spec compliance since 12.1 (Bug 16063217): calling commit/rollback on a connection in AUTOCOMMIT mode raises SQLException ("Could not commit/rollback with auto-commit set on", surfaced as ORA-17273 in current 23ai drivers). Earlier Oracle drivers silently no-op'd the call. ruby-plsql calls commit/rollback explicitly throughout, so without setAutoCommit(false) every commit/rollback errors out under modern drivers and cascades into spec failures (cursors not closed, temp tables not dropped, etc.). Set setAutoCommit(false) explicitly after creating the raw JDBC connection in JDBCConnection.create_raw and in the spec test harness. This restores the long-standing behavior the gem relies on and matches the workaround documented for ruby-plsql#121. References: - Oracle Database 12.1 Release Notes, Bug 16063217 https://docs.oracle.com/database/121/READM/chapter12101.htm#READM316 - ruby-plsql#121 #121
1 parent adea17e commit 5e770b6

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/plsql/jdbc_connection.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def self.create_raw(params)
6464
props.setProperty("password", params[:password])
6565
end)
6666
end
67+
conn.setAutoCommit(false)
6768
new(conn)
6869
end
6970

spec/spec_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def get_connection(user_number = 0)
9999
props.setProperty("user", database_user)
100100
props.setProperty("password", database_password)
101101
end)
102-
end
102+
end.tap { |c| c.setAutoCommit(false) }
103103
end
104104
end
105105
end

0 commit comments

Comments
 (0)