In the past few weeks, I have been trying to connect Oracle db from my nodejs code. So far I have found two main libraries, such as https://github.com/mariano/node-db-oracle , which is deprecated (the last update was a year ago), and the second is https://github.com/nearinfinity/ node-oracle , which is really updated, however I was not able to connect oracle with any of these modules.
Mayor issues npm install oracle // pr db-oracle fails due
../src/connection.h:10:18: fatal error: occi.h: No such file or directory
I tried to clone the code and perform a local installation, and then copy the entire module to my project, install wen well, but when I put the module in my project, I encounter this error
module.js:340 throw err; ^ Error: Cannot find module './build/Release/oracle_bindings' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/var/www/node-test/node_modules/db-oracle/db-oracle.js:18:15) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17)
I followed the installation procedure for both drivers and was setting up variables for example (/ var / environment)
OCI_HOME=/opt/instantclient_12_1 OCI_VERSION=12 OCI_INCLUDE_DIR=/opt/instantclient_12_1/sdk/include OCI_LIB_DIR=/opt/instantclient_12_1 LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client/lib
I used ubuntu 12.04, and node version v0.10.18 here is an example nodejs test file:
var oracle = require('oracle'); new oracle.Database({ hostname: 'myserver.com', port: 1521, user: 'myuser', password: 'mypass', database: 'XE' }).connect(function(error) { if (error) { return console.log("CONNECTION ERROR: " + error); } this.query("select * FROM `store`").execute(function(error, rows) { if (error) { return console.log('ERROR: ' + error); } console.log(rows.length + ' ROWS'); }); });
any additional hint would have been nice. I tried noradle ( https://github.com/kaven276/noradle ), which seems like it is heavy for my purpose.