-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
With the update to oracledb 4.1 I can not insert Dates anymore.
The following code works with oracledb 3.1.2
import { oracleOpts } from './oracleOpts'
import oracledb from 'oracledb'
// Create Table for test
// CREATE TABLE dailytt_actual.demo_date
// (
// my_time DATE
// );
test('Insert Date Test', async () => {
const connection = await oracledb.getConnection(oracleOpts)
const myDate = new Date()
try {
await connection.execute(
'INSERT INTO demo_date (my_time) values (:1)',
[myDate],
{
autoCommit: false,
batchErrors: false,
bindDefs: [{ type: oracledb.DATE }],
}
)
console.log('Date Inserted')
} catch (e) {
console.log(e)
}
await connection.close()
})
Since version 4.1 I get the following Error
Error: NJS-044: named JSON object is not expected in this context
at Connection.execute (/Users/torstenlink/Documents/entwicklung/bahn/e2e/e2e-step/e2e-step-oracle/node_modules/oracledb/lib/connection.js:169:17)
at /Users/torstenlink/Documents/entwicklung/bahn/e2e/e2e-step/e2e-step-oracle/node_modules/oracledb/lib/util.js:180:16
at new Promise (<anonymous>)
at Connection.execute (/Users/torstenlink/Documents/entwicklung/bahn/e2e/e2e-step/e2e-step-oracle/node_modules/oracledb/lib/util.js:168:14)
at Object.execute (/Users/torstenlink/Documents/entwicklung/bahn/e2e/e2e-step/e2e-step-oracle/tests/Snippet2Test.js:9:22)