Skip to content

Commit 35ebb70

Browse files
yahondaclaude
andcommitted
Configure ORA_TZFILE to match Oracle 11g server in CI
Both 11g workflows (test_11g.yml, test_11g_ojdbc11.yml) set DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH=true to skip tests that failed because Oracle 11g XE ships timezone file DSTv14 while Instant Client 21.15 embeds v35, producing ORA-01805 on DATE/TIMESTAMP fetches. The same flag was later reused to skip two JDBC network-encryption tests in connection_spec.rb because 11g XE lacks native network encryption -- an unrelated limitation. Adopt the approach from rsim/ruby-plsql#239: copy the v14 timezone data files out of the running gvenzl/oracle-xe:11 container into the Instant Client's oracore/zoneinfo directory and point the client at them via ORA_TZFILE. Set ORA_TZFILE to the basename (timezlrg_14.dat) so Oracle Instant Client resolves it relative to ORACLE_HOME/oracore/zoneinfo/; the absolute-path form produces ORA-01804 in sqlplus. With that in place the ORA-01805 error disappears and the opaque DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH flag can be removed everywhere. The two network-encryption skips are rewired onto DATABASE_VERSION == '11.2.0.2', which is the honest condition -- the limitation is a property of the 11g server, not of any server/client version mismatch. Also drop the stale ORACLE_HOME == '/usr/lib/oracle/21/client64' fallback in timestamp_spec.rb; current workflows use /opt/oracle/instantclient_21_15, so it never matched. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ca63f21 commit 35ebb70

4 files changed

Lines changed: 28 additions & 8 deletions

File tree

.github/workflows/test_11g.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ jobs:
3636
DATABASE_HOST: localhost
3737
DATABASE_PORT: 1521
3838
DATABASE_VERSION: 11.2.0.2
39-
DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH: true
4039

4140
services:
4241
oracle:
@@ -76,6 +75,19 @@ jobs:
7675
- name: Install JDBC Driver
7776
run: |
7877
wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc17.jar -O ./lib/ojdbc17.jar
78+
- name: Configure ORA_TZFILE to match Oracle 11g server
79+
run: |
80+
# Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds
81+
# v35. This mismatch causes ORA-01805 when fetching DATE/TIMESTAMP
82+
# values. Copy the v14 files from the 11g container and point the
83+
# Instant Client at them via ORA_TZFILE.
84+
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-xe:11" -q)
85+
sudo mkdir -p /opt/oracle/instantclient_21_15/oracore/zoneinfo
86+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezlrg_14.dat /tmp/timezlrg_14.dat
87+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezone_14.dat /tmp/timezone_14.dat
88+
sudo mv /tmp/timezlrg_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
89+
sudo mv /tmp/timezone_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
90+
echo "ORA_TZFILE=timezlrg_14.dat" >> $GITHUB_ENV
7991
- name: Create database user
8092
run: |
8193
./ci/setup_accounts.sh

.github/workflows/test_11g_ojdbc11.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ jobs:
3232
DATABASE_HOST: localhost
3333
DATABASE_PORT: 1521
3434
DATABASE_VERSION: 11.2.0.2
35-
DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH: true
3635

3736
services:
3837
oracle:
@@ -71,6 +70,19 @@ jobs:
7170
- name: Install JDBC Driver
7271
run: |
7372
wget -q https://download.oracle.com/otn-pub/otn_software/jdbc/23261/ojdbc11.jar -O ./lib/ojdbc11.jar
73+
- name: Configure ORA_TZFILE to match Oracle 11g server
74+
run: |
75+
# Oracle 11g XE uses timezone file v14; Instant Client 21.15 embeds
76+
# v35. This mismatch causes ORA-01805 when fetching DATE/TIMESTAMP
77+
# values. Copy the v14 files from the 11g container and point the
78+
# Instant Client at them via ORA_TZFILE.
79+
ORACLE_CONTAINER=$(docker ps --filter "ancestor=gvenzl/oracle-xe:11" -q)
80+
sudo mkdir -p /opt/oracle/instantclient_21_15/oracore/zoneinfo
81+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezlrg_14.dat /tmp/timezlrg_14.dat
82+
docker cp "$ORACLE_CONTAINER":/u01/app/oracle/product/11.2.0/xe/oracore/zoneinfo/timezone_14.dat /tmp/timezone_14.dat
83+
sudo mv /tmp/timezlrg_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
84+
sudo mv /tmp/timezone_14.dat /opt/oracle/instantclient_21_15/oracore/zoneinfo/
85+
echo "ORA_TZFILE=timezlrg_14.dat" >> $GITHUB_ENV
7486
- name: Create database user
7587
run: |
7688
./ci/setup_accounts.sh

spec/active_record/connection_adapters/oracle_enhanced/connection_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
end
6666

6767
it "should not encrypt JDBC network connection" do
68-
skip "Oracle 11g XE does not support native network encryption" if ENV["DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH"] == "true"
68+
skip "Oracle 11g XE does not support native network encryption" if ENV["DATABASE_VERSION"] == "11.2.0.2"
6969
if ORACLE_ENHANCED_CONNECTION == :jdbc
7070
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS.merge(jdbc_connect_properties: { "oracle.net.encryption_client" => "REJECTED" }))
7171
conn = ActiveRecord::Base.connection.send(:_connection)
@@ -74,7 +74,7 @@
7474
end
7575

7676
it "should encrypt JDBC network connection" do
77-
skip "Oracle 11g XE does not support native network encryption" if ENV["DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH"] == "true"
77+
skip "Oracle 11g XE does not support native network encryption" if ENV["DATABASE_VERSION"] == "11.2.0.2"
7878
if ORACLE_ENHANCED_CONNECTION == :jdbc
7979
ActiveRecord::Base.establish_connection(SYSTEM_CONNECTION_PARAMS.merge(jdbc_connect_properties: { "oracle.net.encryption_client" => "REQUESTED" }))
8080
conn = ActiveRecord::Base.connection.send(:_connection)

spec/active_record/oracle_enhanced/type/timestamp_spec.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
include SchemaSpecHelper
55

66
before(:all) do
7-
skip if ENV["DATABASE_SERVER_AND_CLIENT_VERSION_DO_NOT_MATCH"] == "true"
8-
if ENV["DATABASE_VERSION"] == "11.2.0.2" && ENV["ORACLE_HOME"] == "/usr/lib/oracle/21/client64"
9-
skip
10-
end
117
ActiveRecord.default_timezone = :local
128
ActiveRecord::Base.establish_connection(CONNECTION_WITH_TIMEZONE_PARAMS)
139
@conn = ActiveRecord::Base.connection

0 commit comments

Comments
 (0)