Skip to content

Add ojdbc17, ojdbc11, and ojdbc8 to JDBC driver search list#259

Merged
yahonda merged 10 commits intorsim:masterfrom
yahonda:add-test-11g-ojdbc11-workflow
Apr 14, 2026
Merged

Add ojdbc17, ojdbc11, and ojdbc8 to JDBC driver search list#259
yahonda merged 10 commits intorsim:masterfrom
yahonda:add-test-11g-ojdbc11-workflow

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented Apr 13, 2026

Summary

Library (lib/, spec/):

  • Add modern Oracle JDBC driver support (ojdbc17, ojdbc11, ojdbc8) with version-aware selection based on the running Java major version. Use Regexp.union to escape . in jar name matching.
  • Bypass DriverManager and call OracleDriver.connect directly 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.
  • Disable JDBC auto-commit on new connections (setAutoCommit(false)). Modern Oracle JDBC drivers follow JDBC 4.1 strictly and raise ORA-17273 if commit/rollback is 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 on when Oracle 12c ojdbc7.jar used #121.
  • Update cursor spec regex to also accept the new "Closed ResultSet" error message wording introduced in ojdbc17 23.x.
  • Move ORACLE_DRIVER constant inside class PLSQL::JDBCConnection to stop polluting the host application's top-level namespace. Polish the loader's error reporting (initialize ojdbc_jars early, point at the Oracle JDBC downloads page when the jar is missing).

CI (.github/workflows/):

  • Upgrade test, test_11g, test_gemfiles, and jruby_head from ojdbc11.jar 23.3 to ojdbc17.jar 23.26.1. Refactor test_11g to use $ORACLE_HOME and job.services.oracle.id instead of hardcoded paths.
  • Add jruby-10.0.5.0 to the test matrix and pin Oracle JDK 21 (via actions/setup-java) for JRuby matrix entries.
  • Pin Oracle JDK 21 for the jruby_head workflow.
  • Add a new test_11g_ojdbc11 workflow that exercises ruby-plsql against Oracle 11g XE on JRuby 10.0.5.0 with ojdbc11.jar, modeled after the same workflow in oracle-enhanced.

README updated with current JDBC driver names and the downloads link.

Test plan

  • All 20 CI checks green (test, test_gemfiles, test_11g)
  • New test_11g_ojdbc11 workflow passes against Oracle 11g XE on JRuby 10.0.5.0

@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch 4 times, most recently from 5394146 to 5587fab Compare April 13, 2026 14:42
@yahonda yahonda requested a review from Copilot April 13, 2026 14:56
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 of ojdbc11.jar (23.3) for most runs.
  • Add a dedicated test_11g_ojdbc11 workflow to keep testing JRuby against Oracle 11g XE with ojdbc11.jar.
  • Refactor test_11g workflow to use $ORACLE_HOME and job.services.oracle.id instead 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.

Comment thread lib/plsql/jdbc_connection.rb Outdated
@yahonda yahonda changed the title Upgrade JDBC driver to ojdbc17.jar and add test_11g_ojdbc11 workflow Upgrade JDBC driver to ojdbc17.jar and add modern driver support Apr 13, 2026
@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch 2 times, most recently from c488f10 to 24e5a38 Compare April 13, 2026 15:08
@yahonda yahonda requested a review from Copilot April 13, 2026 15:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/jruby_head.yml
@yahonda yahonda changed the title Upgrade JDBC driver to ojdbc17.jar and add modern driver support Add ojdbc17, ojdbc11, and ojdbc8 to JDBC driver search list Apr 13, 2026
@yahonda yahonda requested a review from Copilot April 13, 2026 15:18
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/plsql/jdbc_connection.rb Outdated
Comment thread lib/plsql/jdbc_connection.rb Outdated
Comment thread spec/spec_helper.rb
Comment thread .github/workflows/test.yml
Comment thread .github/workflows/jruby_head.yml
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/plsql/jdbc_connection.rb
Comment thread spec/spec_helper.rb
Comment thread .github/workflows/test_11g_ojdbc11.yml
Comment thread lib/plsql/jdbc_connection.rb Outdated
Comment thread lib/plsql/jdbc_connection.rb
@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch 4 times, most recently from 112fbcb to f7d08e1 Compare April 14, 2026 00:25
@yahonda yahonda requested a review from Copilot April 14, 2026 00:27
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/plsql/jdbc_connection.rb
@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch from f7d08e1 to ced3fe4 Compare April 14, 2026 00:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/test.yml
Comment thread .github/workflows/test_gemfiles.yml Outdated
Comment thread .github/workflows/test_11g.yml
@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch from 0d77bbf to 1905d05 Compare April 14, 2026 00:51
@yahonda yahonda requested a review from Copilot April 14, 2026 00:52
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/plsql/jdbc_connection.rb
Comment thread README.md Outdated
Comment thread .github/workflows/test_11g_ojdbc11.yml Outdated
yahonda and others added 6 commits April 14, 2026 10:20
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>
yahonda and others added 4 commits April 14, 2026 10:26
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
@yahonda yahonda force-pushed the add-test-11g-ojdbc11-workflow branch from 4575282 to 1a13513 Compare April 14, 2026 01:27
@yahonda yahonda merged commit 556cd30 into rsim:master Apr 14, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants