Skip to content

Commit

Permalink
fix: craft oracle connectString as a descriptor with SID (#7878)
Browse files Browse the repository at this point in the history
this allows us to more explicitly pass the SID correctly as the SID
  • Loading branch information
imnotjames committed Jul 9, 2021
1 parent 5f20eb7 commit b05d093
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/driver/oracle/OracleDriver.ts
Expand Up @@ -729,11 +729,32 @@ export class OracleDriver implements Driver {

credentials = Object.assign({}, credentials, DriverUtils.buildDriverOptions(credentials)); // todo: do it better way

if (!credentials.connectString) {
let address = `(PROTOCOL=TCP)`;

if (credentials.host) {
address += `(HOST=${credentials.host})`;
}

if (credentials.port) {
address += `(PORT=${credentials.port})`;
}

let connectData = `(SERVER=DEDICATED)`;

if (credentials.sid) {
connectData += `(SID=${credentials.sid})`;
}

const connectString = `(DESCRIPTION=(ADDRESS=${address})(CONNECT_DATA=${connectData}))`;
Object.assign(credentials, { connectString });
}

// build connection options for the driver
const connectionOptions = Object.assign({}, {
user: credentials.username,
password: credentials.password,
connectString: credentials.connectString ? credentials.connectString : credentials.host + ":" + credentials.port + "/" + credentials.sid,
connectString: credentials.connectString,
}, options.extra || {});

// pooling is enabled either when its set explicitly to true,
Expand Down

0 comments on commit b05d093

Please sign in to comment.