Closed worksofliam closed 5 years ago
Hey Liam,
Looks to me the error originates here while allocating the environment.
SQL_ERROR
was returned you can read more on SQLAllocEnv
Without an environment handle allocated connections and statements wont work.
What version of idb-connector
do you have installed?
Can you provide the code snippet you used with the idb-pconnector
?
I tried running the example above with idb-connector
on 7.3 with node 10.15.0 and it was successful
Hey @abmusse
Below is the example code for the idb-pconnector, but gives the same error as idb-connector.
const moment = require('moment');
const { Connection, Statement } = require('idb-pconnector');
const connection = new Connection({ url: '*LOCAL' });
module.exports = function(app) {
app.get('/customer', async function(req, res) {
const statement = new Statement(connection);
const results = await statement.exec('SELECT CUSNUM FROM QIWS.QCUSTCDT');
statement.close();
res.json(results);
});
}
ERROR: SQLALLOCENV(1)Example app listening on port 9123!
This issue has been resolved. It was happening because the following symlinks were overwritten to be true files:
/usr/lib/libdb400.a
/QOpenSys/usr/lib/libdb400.a
This happens when someone attempts to build db2sock.
These files should really be symlinks which point to /QOpenSys/QIBM/ProdData/OS400/PASE/lib/libdb400.a
Running the following commands fixed this the issue and the script is now running:
bash-4.4$ mv libdb400.a libdb400.a.bak
bash-4.4$ ls libdb400*
libdb400.a.bak libdb400.a.prod libdb400.exp
bash-4.4$ ln -s /QOpenSys/QIBM/ProdData/OS400/PASE/lib/libdb400.a libdb400.a
bash-4.4$ ls libdb400*
libdb400.a libdb400.a.bak libdb400.a.prod libdb400.exp
Friends don't let friends use db2sock :wink:
Hi, I obtain the same error with my nodejs12 "chrooted" environnement (with ibmichroot). I think the problem concerns the libdb400.a too, but in my chroot environnement, I don't have access to the /QOpenSys/QIBM/xxx subfolders (principle of my chroot jail).
In my jail, /usr/lib/libdb400.a and /QOpenSys/usr/lib/libdb400.a are real files (no symlink). Do you know how I can solve that ?
@GautierFR , does /QOpenSys/QIBM/ProdData/OS400/PASE/lib/libdb400.a
exist in your chroot?
Also, how did you create your chroot environment?
Please open a fresh issue so we can route and handle accordingly. Remediation might differ for your chroot case.
@ThePrez Ok, thank you. I created a new issue on idb-connector project : https://github.com/IBM/nodejs-idb-connector/issues/125
Hi
I have tried using the examples out of
pconnector
and the regularconnector
, but both return with the same error.Gives me:
The
pconnector
gives me:Any initial ideas what the issue could be? If these examples are supposed to be working, what can I check on my system to determine the issue. I am using Node.js 10.15.0 and I am on IBM i 7.3.