Hello I am a beginner in nodejs and I would like to connect to a remote oracle db.
Here is the code:
const express = require('express')
const oracledb = require('oracledb')
const app = express()
const port = 3000
oracledb.getConnection(
{
user : "xxx",
password : "xxx",
connectString : "(tns names connection string)))"
},
oracledb.connExecute
)
app.get('/', (req, res) => {
if(connExecute == true) {
console.log("Conexiune reusita");
} else {
console.log("Conexiune esuata");
}
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)
})
When I enter the command node index.js in the cmd I get this error:
Example app listening on port 3000
node:internal/process/task_queues:96
runMicrotasks();
^
Error: NJS-009: invalid number of parameters
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I have installed oracledb with npm. Can you please tell me what I am doing wrong or give me and working example. Thanks
.then(() => {}).catch(() => {})as an alternative toasync/await. Here are the official Getting Stared docs for reference: oracle.github.io/node-oracledb/doc/api.html#getstarted