Reputation: 7484
I'm trying to use node-oracle to connect to a Oracle 11g database in UNIX. I can connect fine to the database using TOAD, but now I want to do application queries and this is what I did:
NodeJS code:
var oracle = require('oracle');
var connectData = {
hostname: "host.com",
port: 1521,
database: "DB0000",
user: "me",
password: "password"
}
oracle.connect(connectData, function(err, connection) {
if (err) { console.log("Error connecting to db:", err); return; }
connection.execute("SELECT systimestamp FROM dual", [], function(err, results) {
if (err) { console.log("Error executing query:", err); return; }
console.log(results);
connection.close();
});
});
Then I this command on the unix box:
sh-3.2$ OCI_LIB_DIR= /oracle/client/v11.2.0.2-64bit/client_1/lib/ OCI_INCLUDE_DIR=/client/v11.2.0.2-64bit/client_1/rdbms/public/ OCI_HOME=/oracle/clien
t/v11.2.0.2-64bit/client_1/ NLS_LANG=.UTF8 LD_LIBRARY_PATH=/client/v11.2.0.2-64bit/client_1/lib/ /bin/node app.js
I get the following error:
terminate called after throwing an instance of 'oracle::occi::SQLException'
what(): Error while trying to retrieve text for error ORA-01804
Some notes:
node
command.I've looked around the web and a lot of people point this to a poorly configured LD_LIBRARY_PATH
variable. If I ls
that folder I get:
acfslib.pm libclient11.a libgnsjni11.so libmm.a libntcpaio11.so liboraz.a libsql11.a naect_std.o.dbl sscoreed.o
acfsroot.pl libclntsh.so libhasgen11.so libn11.a libntcps11.a liborion11.a libsqlplus.a naedhs.o stubs
acfstoolsdriver.sh libclntsh.so.10.1 libheteroxa11.so libnbeq11.a libntcps11_std.a.dbl libowm2.so libsqlplus.so naeet.o sysliblist
activation.jar libclntsh.so.11.1 libimf.a libncrypt11.a libntns11.a libplc11.a libsqora.so.11.1 naeet_std.o.dbl transx.zip
classgen.jar libclntst11.a libintlc.so.5 libnhost11.a libnus11.a libplc11_pic.a libsrvm11.so nautab.o xmlcomp2.jar
clntsh.map libclsra11.so libipgo.a libnjni11.so libnzjs11.a libplp11.a libsrvmhas11.so nautab_std.o.dbl xmlcomp.jar
facility.lis libcommon11.a libipp_bz2.a libnl11.a libocci11.a libplp11_pic.a libsrvmocr11.so nigcon.o xml.jar
jcr-1.0.jar libcore11.a libippcore.a libnldap11.a libocci.so libpls11.a libsvml.a nigtab.o xmlmesg.jar
jdev-rt.zip libcorejava.so libippdcemerged.a libnls11.a libocci.so.11.1 libpls11_pic.a libuini11.so nnfgt.o xmlparserv2.jar
lclasses12.zip libcxaguard.so.5 libippdcmerged.a libnnet11.a libocijdbc11.so libpsa11.a libunls11.a ntcontab.o xmlparserv2_jaxp_services.jar
lclasses14.zip libdbcfg11.so libippsemerged.a libnnetd11.a libocr11.so librdjni11.so libvsn11.a ojcr.jar xmlparserv2_sans_jaxp_services.jar
ldflags libeons.so libippsmerged.a libnnz11.a libocrb11.so libskgxn2.so libvsn11_std.a.dbl oraclexsql.jar xschema.jar
ldflagsO libexpat.a libipp_z.a libnnz11.so libocrutl11.so libskgxp11.so libwwg.a osds_acfslib.pm xsqlserializers.jar
libagent11.a libexpat.la libirc.a libnoname11.a liboevm.a libskgxpcompat.so libxdb.so osds_acfsroot.pm xsu12.jar
libagfw11.so libexpat.so libldapclnt11.a libnque11.so libons.so libskgxpd.so libxml11.a osds_unix_linux_acfslib.pm
libagtsh.so libexpat.so.1 libldapjclnt11.a libnro11.a libonsx.so libskgxpg.so libzt11.a osntabst.o
libagtsh.so.1.0 libexpat.so.1.5.2 libldapjclnt11.so libnsgr11.a liborabz2.a libskgxpr.so libztkg11.a s0main.o
libasmclntsh11.so libgeneric11.a liblxled.a libnsslb11.a liborasdkbase.so.11.1 libslax11.a mail.jar schagent.jar
libcell11.so libgns11.so liblzopro.a libntcp11.a liborasdk.so.11.1 libsnls11.a naect.o scorept.o
Any help would be greatly appreciated.
I've looked at these question, but although similar I couldn't troubleshoot my problem with them:
Cheers.
Upvotes: 0
Views: 18710
Reputation: 764
In my case I solved it like this for python
I solved this by simply zipping the files properly with the symbolic links
First I created three symbolic links :
ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so.1
ln -s ./lib/libaio.so.1.0.1 ./lib/libaio.so
ln -s ./lib/libaio.so.1.0.1 ./libaio.so.1.0.1
ln -s ./lib/libclntsh.so.12.1 ./lib/libclntsh.so
then I was zipping it incorrectly I did it like this:
zip --symlinks -r9 ~/lamda.zip *
It worked! properly then.Hope it helps somebody.
Upvotes: 2
Reputation: 7484
Thanks to @evenro, I went back to look at Error while trying to retrieve text for error ORA-01804 and tried setting the ORACLE_HOME
environment variable.
It worked, but then I started checking which variables I really needed, so in the end I only used:
This is how it worked in the end:
ORACLE_HOME=/somefolder/oracle/client/v11.2.0.2-64bit/client_1/ LD_LIBRARY_PATH=/somefolder/oracle/client/v11.2.0.2-64bit/client_1/lib/ node app.js
Thank you again for all the help in the comments, much appreciated.
Upvotes: 3