ibmdb / node-ibm_db

IBM DB2 and IBM Informix bindings for node
MIT License
190 stars 151 forks source link

[IBM- OS/390] CLI0600E Invalid connection handle or connection is closed. SQLSTATE=S1000 #834

Closed isl-raph closed 2 years ago

isl-raph commented 2 years ago

Hi everyone,

working in the following environment: node version : v14.17.6 npm version : 6.14.15 uname : OS/390 DB2 version : 12

As many others using Windows, I seem to face a recurring problem trying to connect my DB2 database from my z/Unix environment : Using the example from the documentation :

var ibmdb = require('ibm_db'); var connStr = "DATABASE=;HOSTNAME=;UID=db2user;PWD=password;PORT=;PROTOCOL=TCPIP"; ibmdb.open(connStr, function (err,conn) { if (err) return console.log(err); conn.query('select 1 from sysibm.sysdummy1', function (err, data) { if (err) console.log(err); else console.log(data); conn.close(function () { console.log('done'); }); }); });

I end up with a similar output using console.log on connStr:

DATABASE=XXXX;HOSTNAME=XXXX.XXXX.XX;UID=XXXX;PWD=XXXX;PORT=XXXX;PROTOCOL=TCPIP;

and the following error :

[Error: CLI0600E Invalid connection handle or connection is closed. SQLSTATE=S1000] { error: '[ibm_db] SQL_ERROR', sqlcode: -1, state: 'S1000' }

Can anyone enlighten me ? Is there a step that I'm missing ?

Thank's a lot for your kind help

bimalkjha commented 2 years ago

@isl-raph Call ibmdb.debug(true); in your test program just after var ibmdb = require('ibm_db'); and then share the complete output of the test program. Thanks.

isl-raph commented 2 years ago

Hi, I only got the following :

node-ibm_db logs enabled. and then the same result as already mentionned. I went to the ibm_db folder to see if a log subfolder was created but nothing new in there either...

Thank you for your help

bimalkjha commented 2 years ago

@isl-raph cd to ibm_db directory and run below commands. Please share the complete output of below commands:

cd .../ibm_db
npm install
cd ibm_db/installer
source setenv.sh
cd clidriver/bin
file db2cli
./db2level
cd ibm_db/test
vi config.testConnectionStrings.json => update connection info and save.
node test-basic-test.js
./trace test-basic-test.js

Thanks.

bimalkjha commented 2 years ago

Closing the case as of now. Please reopen if issue still exist and you have above requested info. Thanks.