Reputation: 93
I'm attempting to upgrade my Node.js application to Node 22, but I'm encountering issues with connecting to Oracle DB using node-oracledb in Thick Mode. The same configuration works without issues in Node 20, but with Node 22, I receive the following error:
NJS-045: cannot load a node-oracledb Thick mode binary for Node.js. Please try using Thin mode.
Looked for D:\...\my-project\node_modules\oracledb\build\Release\oracledb-6.6.0-win32-ia32.node, ...
C:\oracle\instantclient_basic_windows_x64_23_5_0_24_07\instantclient_23_5
Here's the relevant portion of the code where I initialize the Oracle client:
const oracledb = require('oracledb');
const knex = require('knex');
const libDir = "C:\\oracle\\instantclient_basic_windows_x64_23_5_0_24_07\\instantclient_23_5";
oracledb.initOracleClient({ libDir });
const client = knex({
client: 'oracledb',
connection: {
user: config.oracle.user,
password: config.oracle.password,
connectString: config.oracle.connectionString
},
pool: {
min: config.connectionPool.min,
max: config.connectionPool.max,
idleTimeoutMillis: config.connectionPool.idleTimeout
},
acquireConnectionTimeout: config.connectionPool.acquireConnectionTimeout
});
const result = await client.raw('SELECT 1 FROM DUAL');
With Node 22, I get the following error:
Error: NJS-045: cannot load a node-oracledb Thick mode binary for Node.js. Please try using Thin mode.
Looked for D:\...\my-project\node_modules\oracledb\build\Release\oracledb-6.6.0-win32-ia32.node, ...
libDir
path is correct and points to the Instant Client.PATH
environment variable includes the path to the Oracle Instant Client.node-oracledb
in Thick Mode with Node 22?Any insights or suggestions would be greatly appreciated!
Upvotes: 1
Views: 269
Reputation: 10721
Use the attribute name in the parameter:
const libDir = "C:\\oracle\\instantclient_basic_windows_x64_23_5_0_24_07\\instantclient_23_5";
oracledb.initOracleClient({ libDir: libDir });
Upvotes: 0