datatables.net node.js editor example won't run with oracledb through knex
datatables.net node.js editor example won't run with oracledb through knex
I'm pilot testing datatables for my company, and I'm able to run the editor/node.js example with mysql running locally on my machine. All the examples run just fine at https://localhost:8081/examples
.
All things being equal, i modify the db.js
file to say the following:
let knex = require('knex');
module.exports = knex({
client: 'oracledb',
connection: {
host: 'oracledev',
user: 'test',
password: 'test',
database: 'orcl'
}
});
And then attempt to run the example with npm start
and i get the following output
DataTables Editor demo - navigate to http://localhost:8081/
TypeError: Cannot read property 'replace' of undefined
the line that comes back right after the server starts is TypeError: Cannot read property 'replace' of undefined
And the source of that error i'm finding is very difficult to track down.
Please advise!
Answers
Hi,
In the
index.js
file, could you remove:then run the server again. It should then show a full dump with backtrace information which will hopefully help in debugging the issue. Could you show me that output?
Thanks,
Allan
Removing that snippet from
index.js
didn't produce new results when starting the server. However, when I attempt to load a page likehttp://localhost:8081/examples/simple/simple.html
I get the following output:In response to Line 3 At first, this might appear that I haven't added my sample data to oracle. But that isn't so. I followed this tutorial in inserting all the sample data, and it's all committed. But this line does imply knex is (I'm assuming) getting a connection to oracle here.
Obviously there's a problem somewhere, and I'm a newbie to both datatables and knex, and maybe this is a knex issue more than a datatables issue... it could definitely be an oracle issue. I'm still not sure.
Oracle in combination with NodeJS is one of the combinations we don't currently run through our automated tests, so it is quite possible there is an issue somewhere here.
What about if you attempt to make a simple database query in the
db.js
file - something like:The
setTimeout
so we can useasync
/await
and also let the connection setup settle.Thanks,
Allan
TypeError: knex.select is not a function
is the new error. Heres the full output:I boosted the
setTimeout
to 10 seconds, just to be sure, same results. Here's thedb.js
file as it stands now:Is there any other information I can provide? I know it's difficult to solve a problem when you don't have all the facts/details. We've been using node-oracledb to make connections in the past with success.
Any further word on this?
Sorry for the delay in getting back to you here - I lost track of this thread!
I realise what I did wrong with the code above. Try:
That I think should at least let it run a query. It will be interesting to know if that executes okay.
Thanks,
Allan
Error: ORA-00942: table or view does not exist
but the data is in place, not sure what I'm doing wrong to access it. Is there some way I can get some more direct support on this? Again, very interested in datatables editor but need to purchase in the next two weeks. But we're an oracle shop, and if it doesn't work with oracle, we have to go a different direction.Allan, thanks again for the support call.
For the sake of being complete on this forum, what ended up solving the issue was adding a line to
db.js
.Knex
was putting"
double quotation marks around the table name, and oracle didn't like that.See this github issue.