Skip to content

Add :sid and :service_name connection options#289

Merged
yahonda merged 1 commit intorsim:masterfrom
yahonda:add-sid-and-service-name-options
May 8, 2026
Merged

Add :sid and :service_name connection options#289
yahonda merged 1 commit intorsim:masterfrom
yahonda:add-sid-and-service-name-options

Conversation

@yahonda
Copy link
Copy Markdown
Collaborator

@yahonda yahonda commented May 8, 2026

Summary

  • Add explicit :service_name and :sid connection options on top of the existing :database, mirroring rsim/oracle-enhanced#2669 so the two gems share the same configuration shape.
  • The three keys are mutually exclusive — supplying more than one raises ArgumentError. :service_name rejects /-prefixed values; :sid is validated against \A[\w$#]+\z.
  • :sid builds jdbc:oracle:thin:@host:port:SID on JDBC and an inline TNS connect descriptor (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=...)(PORT=...))(CONNECT_DATA=(SID=...))) on OCI, closing the OCI gap (previously SID-based connections required a hand-built TNS string).
  • The legacy database: ":SID" colon-prefix overload still works but is deprecated and emits a Kernel.warn pointing at :sid.

Test plan

  • DATABASE_USER=hr DATABASE_PASSWORD=hr DATABASE_USER2=arunit DATABASE_PASSWORD2=arunit bundle exec rspec spec/plsql/connection_spec.rb — 47 examples, 0 failures
  • Verify under JRuby that sid: and service_name: connect against an XE / 23ai instance respectively
  • Verify the deprecation warning fires for database: ":XE"

🤖 Generated with Claude Code

@yahonda yahonda force-pushed the add-sid-and-service-name-options branch 2 times, most recently from 9f97b95 to e04391d Compare May 8, 2026 04:27
Match the oracle-enhanced adapter (rsim/oracle-enhanced#2669) by
introducing explicit `:service_name` and `:sid` aliases for `:database`.
The three keys are mutually exclusive — supplying more than one raises
ArgumentError. `:service_name` builds the EZCONNECT (service-name) URL;
`:sid` builds the legacy SID URL on JDBC and an inline TNS connect
descriptor on OCI, so SID-based connections now work under the OCI
driver too. The `database: ":SID"` colon-prefix overload still works
but is deprecated and emits a warning pointing at `:sid`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@yahonda yahonda force-pushed the add-sid-and-service-name-options branch from e04391d to d13043c Compare May 8, 2026 04:30
@yahonda yahonda merged commit 959e88b into rsim:master May 8, 2026
20 checks passed
@yahonda yahonda deleted the add-sid-and-service-name-options branch May 8, 2026 04:47
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.

1 participant