Skip to content

Commit

Permalink
feat: use node-oracledb 6 (#10285)
Browse files Browse the repository at this point in the history
* chore: increase oracledb version

* feat: optionally use thick client

BREAKING CHANGE: With node-oracledb the thin client is used as default. Added a option to use the thick client. Also added the option to specify the instant client lib

closes: #10277

* fix: make thick driver the default, to assure an easy transition from version 5 to 6

* fix: make thin driver default again

Since there should be no problems with oracle db version >= 12.1
For oracle db < 12.1 the thick client must be used.

* chore: increase oracledb to 6.1.0

* chore: increase oracledb to 6.2.0 and added new option binaryDir

* refactor: fix linting

* update oracledb to 6.3.0
  • Loading branch information
ertl committed Dec 29, 2023
1 parent d41930f commit 3af891a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
"mongodb": "^5.8.0",
"mssql": "^9.1.1 || ^10.0.1",
"mysql2": "^2.2.5 || ^3.0.1",
"oracledb": "^5.1.0",
"oracledb": "^6.3.0",
"pg": "^8.5.1",
"pg-native": "^3.0.0",
"pg-query-stream": "^4.0.0",
Expand Down
16 changes: 16 additions & 0 deletions src/driver/oracle/OracleConnectionOptions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { BaseDataSourceOptions } from "../../data-source/BaseDataSourceOptions"
import { OracleConnectionCredentialsOptions } from "./OracleConnectionCredentialsOptions"

export interface OracleThickModeOptions {
binaryDir?: string
configDir?: string
driverName?: string
errorUrl?: string
libDir?: string
}

/**
* Oracle-specific connection options.
*/
Expand All @@ -23,6 +31,14 @@ export interface OracleConnectionOptions
*/
readonly driver?: any

/**
* Utilize the thick driver. Starting from oracledb version 6, it's necessary to set this to true when opting for the thick client usage.
* Alternatively, an 'OracleThickModeOptions' object can be configured, which is used for the thick mode configuration by passing it to the 'node-oracledb' driver.
* For additional information, refer to the details provided in the following link:
* (https://node-oracledb.readthedocs.io/en/latest/api_manual/oracledb.html#oracledb.initOracleClient)
*/
readonly thickMode?: boolean | OracleThickModeOptions

/**
* A boolean determining whether to pass time values in UTC or local time. (default: false).
*/
Expand Down
6 changes: 6 additions & 0 deletions src/driver/oracle/OracleDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,12 @@ export class OracleDriver implements Driver {
} catch (e) {
throw new DriverPackageNotInstalledError("Oracle", "oracledb")
}
const thickMode = this.options.thickMode
if (thickMode) {
typeof thickMode === "object"
? this.oracle.initOracleClient(thickMode)
: this.oracle.initOracleClient()
}
}

/**
Expand Down

0 comments on commit 3af891a

Please sign in to comment.