Add ojdbc17, ojdbc11, and ojdbc8 to JDBC driver search list#259
Add ojdbc17, ojdbc11, and ojdbc8 to JDBC driver search list#259yahonda merged 10 commits intorsim:masterfrom
Conversation
5394146 to
5587fab
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates JRuby Oracle connectivity and CI by upgrading the Oracle JDBC driver used in workflows and improving how the driver jar is selected/loaded at runtime.
Changes:
- Upgrade CI workflows to download
ojdbc17.jar(23.26.1) instead ofojdbc11.jar(23.3) for most runs. - Add a dedicated
test_11g_ojdbc11workflow to keep testing JRuby against Oracle 11g XE withojdbc11.jar. - Refactor
test_11gworkflow to use$ORACLE_HOMEandjob.services.oracle.idinstead of hardcoded paths /docker ps.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Updates JRuby JDBC driver download guidance to modern jar names/Java versions. |
| lib/plsql/jdbc_connection.rb | Updates JDBC jar selection logic based on parsed Java major version (adds ojdbc17/11/8 support). |
| .github/workflows/test.yml | Downloads ojdbc17.jar in the main test workflow. |
| .github/workflows/test_gemfiles.yml | Downloads ojdbc17.jar for gemfile matrix runs. |
| .github/workflows/test_11g.yml | Downloads ojdbc17.jar and simplifies ORA_TZFILE setup using ORACLE_HOME + service container id. |
| .github/workflows/test_11g_ojdbc11.yml | New workflow to run JRuby against Oracle 11g XE while pinning to ojdbc11.jar. |
| .github/workflows/jruby_head.yml | Downloads ojdbc17.jar for scheduled JRuby-head runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c488f10 to
24e5a38
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
112fbcb to
f7d08e1
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f7d08e1 to
ced3fe4
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0d77bbf to
1905d05
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Build the JDBC driver search list based on the running Java major version so that only compatible jars are tried, in priority order preferring the newest driver. Older drivers are still searched as fallbacks since they run on newer Java versions. - ojdbc17.jar for Java 17+ - ojdbc11.jar for Java 11+ - ojdbc8.jar for Java 8+ Use Regexp.union to escape dots in jar name matching to avoid unintended classpath matches. Ref: https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When the Oracle JDBC jar is added to the load path at runtime (rather than being on the system classpath), java.sql.DriverManager refuses to hand out connections with "No suitable driver". Fall back to calling ORACLE_DRIVER.connect directly with username/password properties so the connection still succeeds. The fallback is scoped narrowly: only Java::JavaSql::SQLException whose message matches /no suitable driver/i triggers it; any other SQLException (auth/network/SQL errors) re-raises so the original error surfaces unchanged. Apply the same change in spec/spec_helper.rb so the JRuby test harness behaves consistently.
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
rsim#121
ojdbc17 23.x reports fetches from an auto-closed cursor as ORA-17010 "Closed ResultSet" instead of the older "Closed Statement" message, so the spec regex now also matches the new wording. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move ORACLE_DRIVER and the DriverManager.registerDriver call inside class PLSQL::JDBCConnection so the driver instance is no longer a top-level Ruby constant that pollutes the host application's namespace. Update the spec test harness to reference it via its fully qualified name PLSQL::JDBCConnection::ORACLE_DRIVER. Polish the loader's error reporting: - Hoist `ojdbc_jars = []` above the begin block so the `rescue LoadError` interpolation never references an unbound local even when `require "java"` itself fails. - When the Oracle JDBC jar isn't on the classpath (NameError on Java::oracle.jdbc.OracleDriver), raise a LoadError that hints at installing an Oracle JDBC driver such as ojdbc17.jar and points at https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html
- Upgrade JDBC driver from ojdbc11.jar 23.3 to ojdbc17.jar 23.26.1 in test, test_11g, test_gemfiles, and jruby_head workflows - Refactor test_11g workflow to use $ORACLE_HOME and job.services.oracle.id instead of hardcoded paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1905d05 to
6395e8e
Compare
Add jruby-10.0.5.0 to the `test` workflow matrix so the Oracle JDBC code path is exercised on every push. JRuby 10 targets Java 21 bytecode (class file version 65) and Oracle's ojdbc17.jar is certified with JDK 17 and JDK 21, so install Oracle JDK 21 explicitly via actions/setup-java for JRuby matrix entries (scoped via `if: startsWith(matrix.ruby, 'jruby')`). Picking Oracle JDK matches the distribution most users run in production alongside the Oracle JDBC driver, and Oracle JDK 21 is available at no cost under the NFTC license.
Pin Oracle JDK 21 explicitly via actions/setup-java in the jruby_head workflow so the Oracle JDBC driver loads against a known-good runtime instead of whichever JDK the runner image ships by default. Oracle's ojdbc17.jar is certified with JDK 17 and JDK 21.
Add jruby-10.0.5.0 to the test_11g workflow matrix so the JDBC code path is exercised against Oracle 11g XE. Set up Oracle JDK 21 explicitly via actions/setup-java for JRuby matrix entries (scoped via `if: startsWith(matrix.ruby, 'jruby')`), and gate the Install JDBC Driver step on the same condition so MRI matrix entries skip the unused Oracle download. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a dedicated workflow exercising ruby-plsql against Oracle 11g XE on JRuby 10.0.5.0 with ojdbc11.jar, modeled after the test_11g_ojdbc11 workflow in oracle-enhanced. This keeps ojdbc11 coverage now that the main `test` and `test_11g` workflows have moved to ojdbc17. Pin Oracle JDK 21 via actions/setup-java since ojdbc11.jar is certified with JDK 11 and JDK 21 per Oracle's JDBC downloads page, and JRuby 10 itself requires Java 21. Ref: https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html
4575282 to
1a13513
Compare
Summary
Library (
lib/,spec/):Regexp.unionto escape.in jar name matching.DriverManagerand callOracleDriver.connectdirectly when the jar is added to the load path at runtime and DriverManager raises "No suitable driver". The fallback only triggers on that specific SQLException; all other errors propagate.setAutoCommit(false)). Modern Oracle JDBC drivers follow JDBC 4.1 strictly and raise ORA-17273 ifcommit/rollbackis called while AutoCommit is true (Oracle DB 12.1 Bug 16063217). References: Oracle 12.1 Release Notes,Java::JavaSql::SQLException: Could not rollback with auto-commit set onwhen Oracle 12c ojdbc7.jar used #121.ORACLE_DRIVERconstant insideclass PLSQL::JDBCConnectionto stop polluting the host application's top-level namespace. Polish the loader's error reporting (initializeojdbc_jarsearly, point at the Oracle JDBC downloads page when the jar is missing).CI (
.github/workflows/):test,test_11g,test_gemfiles, andjruby_headfromojdbc11.jar 23.3toojdbc17.jar 23.26.1. Refactortest_11gto use$ORACLE_HOMEandjob.services.oracle.idinstead of hardcoded paths.jruby-10.0.5.0to thetestmatrix and pin Oracle JDK 21 (viaactions/setup-java) for JRuby matrix entries.jruby_headworkflow.test_11g_ojdbc11workflow that exercises ruby-plsql against Oracle 11g XE on JRuby 10.0.5.0 withojdbc11.jar, modeled after the same workflow in oracle-enhanced.README updated with current JDBC driver names and the downloads link.
Test plan
test_11g_ojdbc11workflow passes against Oracle 11g XE on JRuby 10.0.5.0