Skip to content

Commit eb883d9

Browse files
committed
fix(oracle): prevent SID option from conflicting with service_name in connection string
1 parent 27fb8a9 commit eb883d9

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

core/dbio/database/database_oracle.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,17 @@ func (conn *OracleConn) ConnString() string {
128128
// infinite timeout by default
129129
options := map[string]string{"TIMEOUT": "0"}
130130

131+
// When service_name is explicitly provided, do not forward `sid` as an
132+
// option — go-ora's ConnectionConfig prefers SID over ServiceName when
133+
// both are set, which causes ORA-12505 against PDBs/services like
134+
// FREEPDB1. The `sid` prop is often auto-populated from the URL path
135+
// (see connection.setURL), so dropping it here is the safe choice when
136+
// the caller asked for service-name semantics.
137+
serviceName := conn.GetProp("service_name")
131138
for key, new_key := range propMapping {
139+
if key == "sid" && serviceName != "" {
140+
continue
141+
}
132142
if val := conn.GetProp(key); val != "" {
133143
options[new_key] = val
134144
}

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ require (
164164
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
165165
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect
166166
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
167+
github.com/coder/websocket v1.8.14 // indirect
167168
github.com/containerd/console v1.0.5 // indirect
168169
github.com/coreos/go-oidc/v3 v3.5.0 // indirect
169170
github.com/creack/pty v1.1.18 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y
236236
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f/go.mod h1:HlzOvOjVBOfTGSRXRyY0OiCS/3J1akRGQQpRO/7zyF4=
237237
github.com/cockroachdb/apd/v3 v3.2.1 h1:U+8j7t0axsIgvQUqthuNm82HIrYXodOV2iWLWtEaIwg=
238238
github.com/cockroachdb/apd/v3 v3.2.1/go.mod h1:klXJcjp+FffLTHlhIG69tezTDvdP065naDsHzKhYSqc=
239+
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
240+
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
239241
github.com/compose-spec/compose-go/v2 v2.6.0 h1:/+oBD2ixSENOeN/TlJqWZmUak0xM8A7J08w/z661Wd4=
240242
github.com/compose-spec/compose-go/v2 v2.6.0/go.mod h1:vPlkN0i+0LjLf9rv52lodNMUTJF5YHVfHVGLLIP67NA=
241243
github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U=

0 commit comments

Comments
 (0)