off the bat I have looked and tried the following
https://stackoverflow.com/questions/50679120/oracle-db-select-query-returning-the-data-in-form-of-array-instead-of-json-array
^ this is my exact same problem and I have tried the solution and it doesn't work for me.
I also copied the exact same code for as the doucmentation
https://github.com/oracle/node- oracledb/blob/main/examples/example.js#L32:~:text=sql%20%3D%20%60SELECT%20*%20FROM%20no_example%60%3B,rows%2C%20%7B%20depth%3A%20null%20%7D)%3B]
and it still doesn't work.
Below is my code which I am using with node v19.3.0, and oracledb 5.5 (please note it does connect to the DB correctly)
if (err) {
console.error(err.message);
return;
}
else{
options = {
outFormat: oracledb.OUT_FORMAT_OBJECT, // query result format
//extendedMetaData: true // get extra metadata
};
let query = "SELECT * FROM ACCOUNTS";
binds = {};
const result = await connection.execute(query, binds, options);
console.log(result);
doRelease(connection);
}
from this the output is
{
metaData: [ { name: 'USERNAME' }, { name: 'TOKENS' }, { name: 'PASSWORD' } ],
rows: []
}
Connection released
However if I run this exact same query in sql developer (obviously connected to the same DB and with same credentials) I get all accounts... Does anyone know what may be causing this? I am trying to get the values of the fields!
The expected output for this should have been the data inside the table which is 'test' 20, '[email protected]'
result.rowspropertyCOMMITted the transaction in SQL Developer. Until you do commit. only the SQL Developer session can see the rows you've inserted.