From cf737404e36a83849502014cb853dd7845fb3fe2 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 00:08:14 +0900 Subject: [PATCH 01/10] Add modern JDBC driver support (ojdbc17, ojdbc11, ojdbc8) 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) --- README.md | 2 +- lib/plsql/jdbc_connection.rb | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ad52fca..f42932a 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ In addition install either ruby-oci8 (for MRI/YARV) or copy Oracle JDBC driver t If you are using MRI Ruby implementation then you need to install ruby-oci8 gem (version 2.1 or higher) as well as Oracle client, e.g. [Oracle Instant Client](http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html). -If you are using JRuby then you need to download latest [Oracle JDBC driver](http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html) - either ojdbc7.jar for Java 8 and 7, ojdbc6.jar for Java 6, 7, 8 or ojdbc5.jar for Java 5. You can refer [the support matrix](http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#01_03) for details. +If you are using JRuby then you need to download the appropriate [Oracle JDBC driver](https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html) for your Java version - ojdbc17.jar for Java 17+, ojdbc11.jar for Java 11+, ojdbc8.jar for Java 8+, ojdbc7.jar for Java 7, ojdbc6.jar for Java 6, or ojdbc5.jar for Java 5. And copy this file to one of these locations. JDBC driver will be searched in this order: diff --git a/lib/plsql/jdbc_connection.rb b/lib/plsql/jdbc_connection.rb index 95900b8..2c1b90d 100644 --- a/lib/plsql/jdbc_connection.rb +++ b/lib/plsql/jdbc_connection.rb @@ -2,22 +2,24 @@ require "java" require "jruby" - # ojdbc6.jar or ojdbc5.jar file should be in JRUBY_HOME/lib or should be in ENV['PATH'] or load path + # Oracle JDBC driver jar should be in JRUBY_HOME/lib or should be in ENV['PATH'] or load path java_version = java.lang.System.getProperty("java.version") - ojdbc_jars = if java_version =~ /^1.5/ - %w(ojdbc5.jar) - elsif java_version =~ /^1.6/ - %w(ojdbc6.jar) - elsif java_version >= "1.7" - # Oracle 11g client ojdbc6.jar is also compatible with Java 1.7 - # Oracle 12c client provides new ojdbc7.jar - %w(ojdbc7.jar ojdbc6.jar) + java_major = if java_version =~ /^1\.(\d+)/ + $1.to_i else - [] + java_version.to_i end - if ENV_JAVA["java.class.path"] !~ Regexp.new(ojdbc_jars.join("|")) + ojdbc_jars = [] + ojdbc_jars << "ojdbc17.jar" if java_major >= 17 + ojdbc_jars << "ojdbc11.jar" if java_major >= 11 + ojdbc_jars << "ojdbc8.jar" if java_major >= 8 + ojdbc_jars << "ojdbc7.jar" if java_major >= 7 + ojdbc_jars << "ojdbc6.jar" if java_major >= 6 + ojdbc_jars << "ojdbc5.jar" if java_major == 5 + + if ENV_JAVA["java.class.path"] !~ Regexp.union(ojdbc_jars) # On Unix environment variable should be PATH, on Windows it is sometimes Path env_path = (ENV["PATH"] || ENV["Path"] || "").split(File::PATH_SEPARATOR) # Look for JDBC driver at first in lib subdirectory (application specific JDBC file version) From e57583ea8f1ec9999ce3f449aa09024f230c7abd Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 00:29:46 +0900 Subject: [PATCH 02/10] Bypass DriverManager for JDBC connections loaded at runtime 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. --- lib/plsql/jdbc_connection.rb | 17 +++++++++++++++-- spec/spec_helper.rb | 13 ++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/lib/plsql/jdbc_connection.rb b/lib/plsql/jdbc_connection.rb index 2c1b90d..86f6b0d 100644 --- a/lib/plsql/jdbc_connection.rb +++ b/lib/plsql/jdbc_connection.rb @@ -35,7 +35,8 @@ end end - java.sql.DriverManager.registerDriver Java::oracle.jdbc.OracleDriver.new + ORACLE_DRIVER = Java::oracle.jdbc.OracleDriver.new + java.sql.DriverManager.registerDriver ORACLE_DRIVER # set tns_admin property from TNS_ADMIN environment variable if !java.lang.System.get_property("oracle.net.tns_admin") && ENV["TNS_ADMIN"] @@ -51,7 +52,19 @@ module PLSQL class JDBCConnection < Connection # :nodoc: def self.create_raw(params) url = jdbc_connection_url(params) - new(java.sql.DriverManager.getConnection(url, params[:username], params[:password])) + conn = begin + java.sql.DriverManager.getConnection(url, params[:username], params[:password]) + rescue Java::JavaSql::SQLException => e + raise unless e.message =~ /no suitable driver/i + # bypass DriverManager to work in cases where ojdbc*.jar + # is added to the load path at runtime and not on the + # system classpath + ORACLE_DRIVER.connect(url, java.util.Properties.new.tap do |props| + props.setProperty("user", params[:username]) + props.setProperty("password", params[:password]) + end) + end + new(conn) end def self.jdbc_connection_url(params) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index bee44ff..da60e33 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -88,7 +88,18 @@ def get_connection(user_number = 0) end else try_to_connect(Java::JavaSql::SQLException) do - java.sql.DriverManager.getConnection(get_connection_url, database_user, database_password) + begin + java.sql.DriverManager.getConnection(get_connection_url, database_user, database_password) + rescue Java::JavaSql::SQLException => e + raise unless e.message =~ /no suitable driver/i + # bypass DriverManager to work in cases where ojdbc*.jar + # is added to the load path at runtime and not on the + # system classpath + ORACLE_DRIVER.connect(get_connection_url, java.util.Properties.new.tap do |props| + props.setProperty("user", database_user) + props.setProperty("password", database_password) + end) + end end end end From b43cc8368705337a05c1ff39c90426ee45d70dd3 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 07:50:25 +0900 Subject: [PATCH 03/10] 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 https://github.com/rsim/ruby-plsql/issues/121 --- lib/plsql/jdbc_connection.rb | 1 + spec/spec_helper.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/plsql/jdbc_connection.rb b/lib/plsql/jdbc_connection.rb index 86f6b0d..d1c90c0 100644 --- a/lib/plsql/jdbc_connection.rb +++ b/lib/plsql/jdbc_connection.rb @@ -64,6 +64,7 @@ def self.create_raw(params) props.setProperty("password", params[:password]) end) end + conn.setAutoCommit(false) new(conn) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index da60e33..b415edb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -99,7 +99,7 @@ def get_connection(user_number = 0) props.setProperty("user", database_user) props.setProperty("password", database_password) end) - end + end.tap { |c| c.setAutoCommit(false) } end end end From 81f297d5f27ca73a6dbfd8ea31112d520e0c624b Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 07:56:58 +0900 Subject: [PATCH 04/10] Accept Closed ResultSet error message in cursor spec 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) --- spec/plsql/procedure_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/plsql/procedure_spec.rb b/spec/plsql/procedure_spec.rb index b0be396..6a126f1 100644 --- a/spec/plsql/procedure_spec.rb +++ b/spec/plsql/procedure_spec.rb @@ -1875,7 +1875,7 @@ def new_candidate(status) expect(plsql.test_cursor do |cursor| cursor2 = cursor end).to be_nil - expect { cursor2.fetch }.to raise_error(/Cursor was already closed|Closed Statement/) + expect { cursor2.fetch }.to raise_error(/Cursor was already closed|Closed Statement|Closed ResultSet/) end it "should not raise error if cursor is closed inside block" do From 2d45da20a1a9ea94d826235aeb10bba4edd83ad7 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 08:18:29 +0900 Subject: [PATCH 05/10] Namespace ORACLE_DRIVER and polish JDBC loader error handling 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 --- lib/plsql/jdbc_connection.rb | 17 ++++++++++++----- spec/spec_helper.rb | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/plsql/jdbc_connection.rb b/lib/plsql/jdbc_connection.rb index d1c90c0..478b81a 100644 --- a/lib/plsql/jdbc_connection.rb +++ b/lib/plsql/jdbc_connection.rb @@ -1,3 +1,5 @@ +ojdbc_jars = [] + begin require "java" require "jruby" @@ -11,7 +13,6 @@ java_version.to_i end - ojdbc_jars = [] ojdbc_jars << "ojdbc17.jar" if java_major >= 17 ojdbc_jars << "ojdbc11.jar" if java_major >= 11 ojdbc_jars << "ojdbc8.jar" if java_major >= 8 @@ -35,21 +36,27 @@ end end - ORACLE_DRIVER = Java::oracle.jdbc.OracleDriver.new - java.sql.DriverManager.registerDriver ORACLE_DRIVER - # set tns_admin property from TNS_ADMIN environment variable if !java.lang.System.get_property("oracle.net.tns_admin") && ENV["TNS_ADMIN"] java.lang.System.set_property("oracle.net.tns_admin", ENV["TNS_ADMIN"]) end -rescue LoadError, NameError +rescue LoadError # JDBC driver is unavailable. raise LoadError, "ERROR: ruby-plsql could not load Oracle JDBC driver. Please install #{ojdbc_jars.empty? ? "Oracle JDBC" : ojdbc_jars.join(' or ') } library." end module PLSQL class JDBCConnection < Connection # :nodoc: + begin + ORACLE_DRIVER = Java::oracle.jdbc.OracleDriver.new + java.sql.DriverManager.registerDriver ORACLE_DRIVER + rescue NameError + raise LoadError, "ERROR: ruby-plsql could not load Oracle JDBC driver. " \ + "Please install the appropriate Oracle JDBC driver. " \ + "See https://www.oracle.com/database/technologies/appdev/jdbc-downloads.html" + end + def self.create_raw(params) url = jdbc_connection_url(params) conn = begin diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b415edb..8d7cba6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -95,7 +95,7 @@ def get_connection(user_number = 0) # bypass DriverManager to work in cases where ojdbc*.jar # is added to the load path at runtime and not on the # system classpath - ORACLE_DRIVER.connect(get_connection_url, java.util.Properties.new.tap do |props| + PLSQL::JDBCConnection::ORACLE_DRIVER.connect(get_connection_url, java.util.Properties.new.tap do |props| props.setProperty("user", database_user) props.setProperty("password", database_password) end) From 9b16ad36ebc1209a0c143bd44ad052930300569b Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 00:08:20 +0900 Subject: [PATCH 06/10] Upgrade CI workflows to ojdbc17.jar 23.26.1 - 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) --- .github/workflows/jruby_head.yml | 2 +- .github/workflows/test.yml | 2 +- .github/workflows/test_11g.yml | 14 +++++++------- .github/workflows/test_gemfiles.yml | 3 --- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/jruby_head.yml b/.github/workflows/jruby_head.yml index 423d87a..aee79fa 100644 --- a/.github/workflows/jruby_head.yml +++ b/.github/workflows/jruby_head.yml @@ -57,7 +57,7 @@ jobs: echo "/opt/oracle/instantclient_23_26" >> $GITHUB_PATH - name: Install JDBC Driver run: | - wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar + wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar - name: Create database user run: | ./ci/setup_accounts.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c8859e3..0e734fd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -62,7 +62,7 @@ jobs: echo "/opt/oracle/instantclient_23_26" >> $GITHUB_PATH - name: Install JDBC Driver run: | - wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar + wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar - name: Create database user run: | ./ci/setup_accounts.sh diff --git a/.github/workflows/test_11g.yml b/.github/workflows/test_11g.yml index 8083a6e..eb295b1 100644 --- a/.github/workflows/test_11g.yml +++ b/.github/workflows/test_11g.yml @@ -67,19 +67,19 @@ jobs: echo "/opt/oracle/instantclient_21_15" >> $GITHUB_PATH - name: Install JDBC Driver run: | - wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar + wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar - name: Configure ORA_TZFILE to match Oracle 11g server run: | - # Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds v35. - # This mismatch causes ORA-01805 when ruby-oci8 fetches DATE/TIMESTAMP + # Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds + # v35. This mismatch causes ORA-01805 when fetching DATE/TIMESTAMP # values. Copy the v14 files from the 11g container and point the # Instant Client at them via ORA_TZFILE. - ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-xe:11" -q) - sudo mkdir -p /opt/oracle/instantclient_21_15/oracore/zoneinfo + ORACLE_CONTAINER="${{ job.services.oracle.id }}" + sudo mkdir -p "$ORACLE_HOME/oracore/zoneinfo" docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezlrg_14.dat /tmp/timezlrg_14.dat docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezone_14.dat /tmp/timezone_14.dat - sudo mv /tmp/timezlrg_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/ - sudo mv /tmp/timezone_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/ + sudo mv /tmp/timezlrg_14.dat "$ORACLE_HOME/oracore/zoneinfo/" + sudo mv /tmp/timezone_14.dat "$ORACLE_HOME/oracore/zoneinfo/" echo "ORA_TZFILE=timezlrg_14.dat" >> $GITHUB_ENV - name: Create database user run: | diff --git a/.github/workflows/test_gemfiles.yml b/.github/workflows/test_gemfiles.yml index b50d3eb..1f5268b 100644 --- a/.github/workflows/test_gemfiles.yml +++ b/.github/workflows/test_gemfiles.yml @@ -82,9 +82,6 @@ jobs: sudo unzip -qo instantclient-sdk-linux.x64-23.26.1.0.0.zip -d /opt/oracle/ sudo unzip -qo instantclient-sqlplus-linux.x64-23.26.1.0.0.zip -d /opt/oracle/ echo "/opt/oracle/instantclient_23_26" >> $GITHUB_PATH - - name: Install JDBC Driver - run: | - wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/233/ojdbc11.jar -O ./lib/ojdbc11.jar - name: Create database user run: | ./ci/setup_accounts.sh From d8dc593adc5f157aff2d7b89ec63b111ec91e941 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 09:24:03 +0900 Subject: [PATCH 07/10] Add jruby-10.0.5.0 to CI test matrix with Oracle JDK 21 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. --- .github/workflows/test.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e734fd..ba65423 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,14 +8,15 @@ jobs: build: runs-on: ubuntu-latest - continue-on-error: true + continue-on-error: false strategy: matrix: ruby: [ '4.0', '3.4', '3.3', - '3.2' + '3.2', + 'jruby-10.0.5.0', ] env: ORACLE_HOME: /opt/oracle/instantclient_23_26 @@ -42,6 +43,12 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Set up Java + if: startsWith(matrix.ruby, 'jruby') + uses: actions/setup-java@v4 + with: + distribution: oracle + java-version: '21' - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -61,6 +68,7 @@ jobs: sudo unzip -qo instantclient-sqlplus-linux.x64-23.26.1.0.0.zip -d /opt/oracle/ echo "/opt/oracle/instantclient_23_26" >> $GITHUB_PATH - name: Install JDBC Driver + if: startsWith(matrix.ruby, 'jruby') run: | wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar - name: Create database user From edc3c6ef4f84c04869ec4356dfd5065aee306f39 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 09:24:03 +0900 Subject: [PATCH 08/10] Set up Oracle JDK 21 for jruby_head workflow 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. --- .github/workflows/jruby_head.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/jruby_head.yml b/.github/workflows/jruby_head.yml index aee79fa..7525731 100644 --- a/.github/workflows/jruby_head.yml +++ b/.github/workflows/jruby_head.yml @@ -8,7 +8,7 @@ jobs: build: runs-on: ubuntu-latest - continue-on-error: true + continue-on-error: false strategy: matrix: ruby: [ @@ -39,6 +39,11 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: oracle + java-version: '21' - name: Set up Ruby uses: ruby/setup-ruby@v1 with: From a60ef5997c3576ac37f559cf9f4a54b7433260c9 Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 09:49:48 +0900 Subject: [PATCH 09/10] Add jruby-10.0.5.0 to test_11g matrix with Oracle 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) --- .github/workflows/test_11g.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_11g.yml b/.github/workflows/test_11g.yml index eb295b1..a816d9b 100644 --- a/.github/workflows/test_11g.yml +++ b/.github/workflows/test_11g.yml @@ -12,14 +12,15 @@ jobs: if: github.event_name != 'pull_request' || !github.event.pull_request.draft runs-on: ubuntu-latest - continue-on-error: true + continue-on-error: false strategy: matrix: ruby: [ '4.0', '3.4', '3.3', - '3.2' + '3.2', + 'jruby-10.0.5.0', ] env: ORACLE_HOME: /opt/oracle/instantclient_21_15 @@ -46,6 +47,12 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Set up Java + if: startsWith(matrix.ruby, 'jruby') + uses: actions/setup-java@v4 + with: + distribution: oracle + java-version: '21' - name: Set up Ruby uses: ruby/setup-ruby@v1 with: @@ -66,6 +73,7 @@ jobs: sudo unzip -qo instantclient-sdk-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle echo "/opt/oracle/instantclient_21_15" >> $GITHUB_PATH - name: Install JDBC Driver + if: startsWith(matrix.ruby, 'jruby') run: | wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar - name: Configure ORA_TZFILE to match Oracle 11g server From 1a135139eefcdaccec20700eeb4a5738a448286a Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Tue, 14 Apr 2026 08:24:47 +0900 Subject: [PATCH 10/10] Add test_11g_ojdbc11 workflow with Oracle JDK 21 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 --- .github/workflows/test_11g_ojdbc11.yml | 94 ++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 .github/workflows/test_11g_ojdbc11.yml diff --git a/.github/workflows/test_11g_ojdbc11.yml b/.github/workflows/test_11g_ojdbc11.yml new file mode 100644 index 0000000..9873e70 --- /dev/null +++ b/.github/workflows/test_11g_ojdbc11.yml @@ -0,0 +1,94 @@ +name: test_11g_ojdbc11 + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +jobs: + build: + if: github.event_name != 'pull_request' || !github.event.pull_request.draft + + runs-on: ubuntu-latest + continue-on-error: false + strategy: + matrix: + ruby: [ + 'jruby-10.0.5.0' + ] + env: + ORACLE_HOME: /opt/oracle/instantclient_21_15 + LD_LIBRARY_PATH: /opt/oracle/instantclient_21_15 + NLS_LANG: AMERICAN_AMERICA.AL32UTF8 + TNS_ADMIN: ./ci/network/admin + DATABASE_NAME: XE + TZ: Europe/Riga + DATABASE_SYS_PASSWORD: Oracle18 + + services: + oracle: + image: gvenzl/oracle-xe:11 + ports: + - 1521:1521 + env: + TZ: Europe/Riga + ORACLE_PASSWORD: Oracle18 + options: >- + --health-cmd healthcheck.sh + --health-interval 10s + --health-timeout 5s + --health-retries 10 + + steps: + - uses: actions/checkout@v6 + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: oracle + java-version: '21' + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Create symbolic link for libaio library compatibility + run: | + sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1 + - name: Download Oracle instant client + run: | + wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-basic-linux.x64-21.15.0.0.0dbru.zip + wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-sqlplus-linux.x64-21.15.0.0.0dbru.zip + wget -q https://download.oracle.com/otn_software/linux/instantclient/2115000/instantclient-sdk-linux.x64-21.15.0.0.0dbru.zip + - name: Install Oracle instant client + run: | + sudo mkdir -p /opt/oracle/ + sudo unzip -q instantclient-basic-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle + sudo unzip -qo instantclient-sqlplus-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle + sudo unzip -qo instantclient-sdk-linux.x64-21.15.0.0.0dbru.zip -d /opt/oracle + echo "/opt/oracle/instantclient_21_15" >> $GITHUB_PATH + - name: Install JDBC Driver + run: | + wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc11.jar -O ./lib/ojdbc11.jar + - name: Configure ORA_TZFILE to match Oracle 11g server + run: | + # Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds + # v35. This mismatch causes ORA-01805 when fetching DATE/TIMESTAMP + # values. Copy the v14 files from the 11g container and point the + # Instant Client at them via ORA_TZFILE. + ORACLE_CONTAINER="${{ job.services.oracle.id }}" + sudo mkdir -p "$ORACLE_HOME/oracore/zoneinfo" + docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezlrg_14.dat /tmp/timezlrg_14.dat + docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezone_14.dat /tmp/timezone_14.dat + sudo mv /tmp/timezlrg_14.dat "$ORACLE_HOME/oracore/zoneinfo/" + sudo mv /tmp/timezone_14.dat "$ORACLE_HOME/oracore/zoneinfo/" + echo "ORA_TZFILE=timezlrg_14.dat" >> $GITHUB_ENV + - name: Create database user + run: | + ./ci/setup_accounts.sh + - name: Bundle install + run: | + bundle install --jobs 4 --retry 3 + - name: Run RSpec + run: | + RUBYOPT=-w bundle exec rspec