0
I am trying to open a connection pool using the oracledb module but I get an Exception when trying to create the pool
import OracleDB from 'oracledb'
import dotenv from 'dotenv'
OracleDB.outFormat = OracleDB.OUT_FORMAT_OBJECT
dotenv.config()
export class BaseConnection {
public connection: OracleDB.Connection
public connectionPool: OracleDB.Pool
public async openConnection (): Promise<void> {
try {
this.connectionPool = await OracleDB.createPool({
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
connectString: process.env.DB_CONNECTION_STRING
})
this.connection = await this.connectionPool.getConnection()
console.log('Banco de dados conectado com sucesso')
} catch (error) {
console.log(error)
}
}
}
error
{ Error: DPI-1047: Cannot locate a 64-bit Oracle Client library: "Não foi possível encontrar o módulo especificado". See https://oracle.github.io/odpi/doc/installation.html#windows for help
Node-oracledb installation instructions: https://oracle.github.io/node-oracledb/INSTALL.html
You must have 64-bit Oracle client libraries in your PATH environment variable.
If you do not have Oracle Database on this computer, then install the Instant Client Basic or Basic Light package from
http://www.oracle.com/technetwork/topics/winx64soft-089540.html
A Microsoft Visual Studio Redistributable suitable for your Oracle client library version must be available.
at OracleDb.createPool (C:\Proc-evandro\ph\node_modules\oracledb\lib\oracledb.js:180:8)
I made the change and I received this other error, details I am connecting to a database via VPN, I have another application in Node without typescript that I use the same database via pool conection and I do not get this error message.
– Evandro Ignacio
@Evandroignacio, have you noticed that now the error is talking about the 64bit architecture? He even made the procedures informed by the error himself installing the library in 64bits?
– Murilo Portugal
yes, the host machine already has this configuration, I use the same module in another application Node without typescript and the pool is created without errors, I do not understand why I get this error here
– Evandro Ignacio
@Evandroignacio, one thing you should also notice is that in this application you installed the nodedb module locally and not global, see by the error description the path
C:\Proc-evandro\ph\node_modules\oracledb\lib\oracledb.js:180:8
, that is, if the oracledb this location it should not be "reaching" the Oracle Client Libraries, probably in the other projects you used this global module, I suggest that a read on how should be used/ configured the oracledb here– Murilo Portugal