tryggingamidstodin / node-jt400 Goto Github PK
View Code? Open in Web Editor NEWNodeJS JT400 wrapper to connect to IBM iSeries and AS/400 systems (OS400 operating system, database like DB2, programs and filesystem)
License: MIT License
NodeJS JT400 wrapper to connect to IBM iSeries and AS/400 systems (OS400 operating system, database like DB2, programs and filesystem)
License: MIT License
Building on SmartOS fails with a javahome not found error. This is an issue in node-java, however it's been resolved since 0.4.3, the driver builds and is usable with 0.4.3, I've also built and have done some basic testing with [email protected].
This fails to build using SmartOS 15.2 with OpenJDK7 and OracleJDK8.
I realize this is a corner case but was hoping a node-java bump would be possible.
Thanks, Dave
@tryggingamidstodin
I am trying to implement node-jt400 in my code, I am able to make a connection and get the response for a SELECT query, the response is automatically logged in the console. But I dont see the compiler/flow been moved to the .then() block. Here is my code,
pool.query('SELECT ARDTGI, FNAMGI FROM SOMETHING/NIP WHERE KYDTGI = ? and SEQGI = ?', [42703, 2342312])
.then(function (err, result) {
if(err) { console.log(err); }
else { console.log('RESULT here: ' + result); }
});
the code inside then() block is not getting called. Am is missing something or this is an issue with the library?
e.g. configuration properties?
I'm trying to install and run this on an IBM i. After what appears to be a successful installation, I try running the script and the below error is thrown.
Install Log:
npm install node-jt400 --javahome=$JAVA_HOME
[K [?25h [27m [90m... [0m] - build:flushwritable: [34;40mverb [0m [35mlinkMans [0m [email protected] [K[K
[email protected] install /home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java
node-gyp rebuild
gmake: Entering directory /home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java/build' gmake: Nothing to be done for
all'.
gmake: Leaving directory `/home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java/build'
[email protected] postinstall /home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java
node postInstall.js
[email protected] /home/someone/node/projects/remote_users
-- [40m [[email protected] [39m [49m +-- [40m [[email protected] [39m [49m +-- [40m [[email protected] [39m [49m | +-- [40m [[email protected] [39m [49m | +-- [40m [[email protected] [39m [49m | +-- [40m [[email protected] [39m [49m | +-- [40m [[email protected] [39m [49m |
-- [40m [[email protected] [39m [49m
+-- [40m [[email protected] [39m [49m
| +-- [40m [[email protected] [39m [49m
|-- [40m [[email protected] [39m [49m
-- [40m [[email protected] [39m [49m
Runtime Error:
Error: Cannot find module '/home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java/build/Release/nodejavabridge_bindings.node'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/home/someone/node/projects/remote_users/node_modules/node-jt400/node_modules/java/lib/nodeJavaBridge.js:21:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
It appears that the file jdbcwritestream didn't get checked in with the latest commit.
jt400.js line 5:
createJdbcWriteStream = require('./jdbcwritestream'),
I'm trying to install this package but I'm getting errors.
node version: 10.11.0
npm version: 6.4.1
npm install node-jt400 --save
[email protected] install C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
node-gyp rebuild
C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java>if not defined npm_config_node_gyp (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack at PythonFinder. (C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack at C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:154:21)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\jmiles\AppData\Roaming\nvm\v10.11.0\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\jmiles\code\nodeJS\as400Test\node_modules\java
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jmiles\AppData\Roaming\npm-cache_logs\2018-10-04T14_07_55_299Z-debug.log
Hi. A recent SAST scan result from AppScan picked up a security vulnerability from the below line in the HsqlClient class. Is there a reason why quser is hardcoded and not passed in as a parameter?
public Connection getConnection() throws Exception {
return DriverManager.getConnection("jdbc:hsqldb:mem:test", "quser", "");
}
Hi,
i've seen you can read messagequeues. Is it possible to read or even list printerqueues/dataqueues as well?
How i can setup timeouts?
it is possible to call store procedures?
I need to know if there is a method to check if the connection to DB2 is active.
I'm currently using your package with a nestjs application. When I compile the application and run it using standard node main.js
command...everything works just fine. However, if I use a node process manager PM2 it get the following error. Not sure if you have any advice on what I can check/do to resolve this? Any help is appreciated.
Error: libjvm.so: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at Module.Hook._require.Module.require (/home/dwood/.nvm/versions/node/v10.16.3/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:80:39)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/mnt/document-root/sites/node.vtoll.ksturnpike.com/node_modules/java/lib/nodeJavaBridge.js:21:16)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)```
I find that the SQL query result values are all trimmed.
But currently there is no way to get untrimmed raw value result with the library.
In order to get raw untrimmed value, you may need to do such changes:
In the java class "JdbcJsonClient.java" 's method "query", replace the line
json.put(metaData.getColumnLabel(i), trim(rs.getString(i)));
With
json.put(metaData.getColumnLabel(i), rs.getString(i));
Suggest to have some library option or in query option to switch the trim.
I've tried using the .execute()
method as below, but I get a null pointer exception from Java; presumably because the stored proc doesn't return a results and the Java code expects it to. Is it possible with this library? I was also looking at the .pgm()
method, but was unable to execute it due to lack of documentation (how to specify param type?).
Any help is greatly appreciated!
const pool = require('node-jt400')({/*connection settings*/})
/*some code*/
// not the actual query, but gets the point across
const storedProcQuery = `
BEGIN
DECLARE OUT_PARAM VARCHAR(3)
CALL MY_STORED_PROC(OUT_PARAM);
END`;
pool.execute(storedProcQuery)
.then(statement => statement.asArray())
.then(result => {
console.log(result)
})
.catch(err => {
console.error(err)
})
Error running instance method
java.lang.NullPointerException
at nodejt400.StatementWrap.asArray(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
Really wish for some better documentation. Especially around the IFS and Program calls.
How would you go about writing a file from the local system (where the Node app is running) to the IFS?
Or just how to write data to the a file on the IFS?
I've tried to use the module several times and ways and every time i get the same error when access to pool function
Error: Could not create class nodejt400.JT400
java.lang.NoClassDefFoundError: nodejt400/JT400
Caused by: java.lang.ClassNotFoundException: nodejt400.JT400
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
The code that i'm actually using is:
const config = { host: 'HOST', user: 'USER', password: 'PASS' };
var as400 = require('node-jt400');
var pool = as400.pool(config);
debug("Conn Ret: %O", pool);
Already installed JDK and JRE version 1.7 and checked versions from java and javac...
Could you please give me some help?
Cheers,
MSilvaPT
I see that the code supports structs, but I don't see anything for simple arrays or data structure arrays. Does this library support either of those for RPG calls?
My content is successfully writing to the DB, but I'm getting a error response anyway and I'm not sure it the issue is with my implementation or what. Any insights would be appreciated.
My code:
pool.query(`INSERT INTO ${User.table} (${keys}) VALUES (${values})`)
.then(result => {
response.sendStatus(201).json({
code: 201,
message: 'User created.',
})
})
.catch(error => {
console.log(error)
})
Query:
INSERT INTO DWOOD.QCUSTCDT (CUSNUM,LSTNAM,INIT,STREET,CITY,STATE,ZIPCOD,CDTLMT,CHGCOD,BALDUE,CDTDUE) VALUES (123456,'Wood','D J','9401 Kellogg','Wchita','KS',67207,2000,2,123.09,0) params: []
Error log:
{ [Error: Error running instance method
java.sql.SQLException: Cursor state not valid.
at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:857)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:412)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeQuery(AS400JDBCPreparedStatement.java:1766)
at nodejt400.JdbcJsonClient.query(Unknown Source)
at nodejt400.JT400.query(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
] cause: nodeJava_java_sql_SQLException {} }
I need to close the DB connection once the data is retrieved or when it throws an error.
Is there something like db.close()
?
Do you know if this can be used with Docker? If so, do you know how to structure the dockerfile with openjdk?
I got the following issue when I try to invoke KeyedDataQ :
const dq = connection.createKeyedDataQ(opt.name);
^
Error: Error running instance method
com.ibm.as400.access.ExtendedIllegalArgumentException: objectName (LAMFIC_V4/VLDQSE03): Length is not valid.
at com.ibm.as400.access.QSYSObjectPathName.checkObjectName(QSYSObjectPathName.java:465)
at com.ibm.as400.access.QSYSObjectPathName.toPath(QSYSObjectPathName.java:1098)
at nodejt400.KeyedDataQ.(KeyedDataQ.java:21)
at nodejt400.JT400.createKeyedDataQ(JT400.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Object.createKeyedDataQ (C:\DEV\node_modules\←[4mnode-jt400←[24m\dist\lib\jt400.js:265:35)
at Object.<anonymous> (C:\DEV\JT400\evalidation.js:12:19)
←[90m at Module._compile (node:internal/modules/cjs/loader:1102:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:967:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:807:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m {
cause: nodeJava_com_ibm_as400_access_ExtendedIllegalArgumentException {}
}
I use the example provided with a name for the LIB/KeyedDtaQ such as :
const jt400 = require('node-jt400').pool(config);
var name = 'QSYS.LIB/MYDTAQ';
// const jt400 = pool(config);
// Open a keyed data queue for reading
let queue = jt400.createKeyedDataQ({name});
// -1 waits until a message exists. (MSGW)
let m = queue.read({key:inboxKey,wait:-1});
I used jt400 few times in the past in some native java programs and never had this issue. Now I wanted to use nodejs and this package. So i call an as400 program passing json as parameter and getting another json in another parameter as response: problem as400 get the '{' and '[' chars as 'à' and 'è' chars...
As400 is set with 1144 CCSID and I see from logs that my pool config is right
Toolbox for Java - JDBC 3.0 Open Source Software, JTOpen 9.1, codebase 5770-SS1 V7R3M0.00 built=20160705 @rf
java.home=/opt/jdk1.8.0_201/jre java.vm.vendor=Oracle Corporation java.vm.info=mixed mode java.runtime.version=1.8.0_201-b09 java.fullversion=null java.vm.version=25.201-b09 java.version=1.8.0_201 os.name=Linux os.version=3.10.0-514.2.2.el7.x86_64
lun lug 8 17:51:36:515 CEST 2019 as400@setString: Properties (1225358173) : package ccsid = "1144".
lun lug 8 17:51:36:521 CEST 2019 as400@setString: Properties (1225358173) : trace = "true".
lun lug 8 17:51:36:522 CEST 2019 as400@setString: Properties (1225358173) : naming = "system".
then when connection is established seems that ccsid is also matching:
lun lug 8 17:51:43:976 CEST 2019 as400: ConnectionPool com.ibm.as400.access.AS400JDBCConnectionPool@6cc9c0a9 (1825161385) : Filling the pool with 1 connections..
lun lug 8 17:51:44:086 CEST 2019 as400@setString: Properties (1225358173) : metadata source = "1".
lun lug 8 17:51:44:089 CEST 2019 as400: Toolbox for Java - Open Source Software, JTOpen 9.1, codebase 5770-SS1 V7R3M0.00 built=20160705 @rf
lun lug 8 17:51:44:090 CEST 2019 as400: JDBC Level: 40
lun lug 8 17:51:44:091 CEST 2019 as400@setString: Properties (1225358173) : package ccsid = "1144".
lun lug 8 17:51:44:092 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Client CCSID = 1144.
lun lug 8 17:51:44:092 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Setting server NLV = 2932.
lun lug 8 17:51:44:095 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Client functional level = V7R2M01 .
lun lug 8 17:51:44:095 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Data compression = RLE.
lun lug 8 17:51:44:095 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : ROWID supported = true.
lun lug 8 17:51:44:095 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : True auto-commit supported = true.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : 128 byte column names supported = true.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : 128 length schema names supported = true.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Maximum decimal precision = 31.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Maximum decimal scale = 31.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Minimum divide scale = 0.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Translate hex = character.
lun lug 8 17:51:44:096 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : query optimize goal = 0.
lun lug 8 17:51:44:097 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : query storage limit = -1.
lun lug 8 17:51:44:097 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Using extended datastreams.
lun lug 8 17:51:44:100 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : JDBC driver major version = 11.
lun lug 8 17:51:44:100 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : IBM i VRM = V7R2M0.
lun lug 8 17:51:44:100 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Server CCSID = 1144.
lun lug 8 17:51:44:100 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Server functional level = V7R2M00016 (16).
lun lug 8 17:51:44:100 CEST 2019 as400: Connection 192.168.10.250 (1223930207) : Server job identifier = 092323/QUSER/QZDASOINIT.
lun lug 8 17:51:44:101 CEST 2019 as400@setString: Properties (1225358173) : decimal separator = ".".
lun lug 8 17:51:44:101 CEST 2019 as400@setString: Properties (1225358173) : date format = "dmy".
lun lug 8 17:51:44:101 CEST 2019 as400@setString: Properties (1225358173) : date separator = "/".
lun lug 8 17:51:44:101 CEST 2019 as400@setString: Properties (1225358173) : time format = "hms".
lun lug 8 17:51:44:101 CEST 2019 as400@setString: Properties (1225358173) : time separator = ":".
lun lug 8 17:51:44:121 CEST 2019 as400: Connection S2120CEW (1223930207) open.
lun lug 8 17:51:44:121 CEST 2019 as400@setProperties: Connection S2120CEW (1223930207) : Auto commit = "true".
lun lug 8 17:51:44:122 CEST 2019 as400@setProperties: Connection S2120CEW (1223930207) : Read only = "false".
lun lug 8 17:51:44:122 CEST 2019 as400@setProperties: Connection S2120CEW (1223930207) : Transaction isolation = "1".
lun lug 8 17:51:44:122 CEST 2019 as400: ConnectionPoolDataSource (1203189789) : connection created.
but when i call the program as400 get characters wrong and so do I if i print the response...
on server the 'localectl status' command give
System Locale: LANG=it_IT.UTF-8
VC Keymap: it
X11 Layout: it
I don't know where the problem could be, I tried many different ccsid in the pool config but results is always the same...
any hint?
thanks
This package is very good, run perfect.
But When I want to make a select from a view "[SQL0204] FROM in * LIBL of type * FILE not found" and if I want to specify the schema of the table does not work either
Any solution?
I was following the example code from npmjs.org and used the following query:
pool.query('SELECT FDFIL1, FDFIL2, FDFIL3, FDFIL4, FDFIL5, FDFIL6 FROM MYLIB/MYFILE WHERE FDFIL1= ? or WHERE FDFIL1= ?', ['T', ' '])
.then(function(result) {
console.log(result[0].FDFIL1);
})
And the console.log prints the entire query and the params requested, not the value that is returned.
Am I missing anything?
I have been using node-jt400 for some time now and I have run into an interesting problem.
I was integrating some custom internal Java programs and ran into this when I started to include them on models that I was using node-jt400.
As soon as two modules using node-java are called it will core dump.
I have an example of it failing located here. node-java-error
Though I feel the problem lies in node-java I have been developing a version of node-jt400 for internal use that allows me to pass an existing node-java instance to it.
I am not sure if you have run into the same problem and either have worked around it or have a fix for it. But if there is interest I will develop it further and make a pull request when done, if not close the issue stating as such.
I have it working but it is not ready for a pull request yet. The changes are not in Typescript and it is a breaking change as you have initialize it before use, but here is the branch. use-existing-node-java
There is two ways of using it.
First without an existing node-java instance.
const as400 = require('node-jt400')();
const pool = as400.pool(config);
Then with an existing instance
const java = require('java');
java.classpath.push(`${__dirname}/java`);
const as400 = require('node-jt400')(java);
const pool = as400.pool(config);
A major caveat with the second one is because node-java requires that you to set up the classpath before calling any Java methods. You have to pass any class paths to node-java before you initialize node-jt400.
Hi there,
Is it possible to specify a default DB schema within the config? E.g. something like...
const config = {
host: '127.0.0.1',
user: 'myuser',
password: 'xxx',
database: 'myDatabase'
}
When strictly following the README example, I get a connection refused error. So is there a default schema setting (and possibly other config parameters) I can pass through? And if not, what could be wrong? Because my host
, username
and password
are correct as I can successfully connect to the DB2 instance (docker DB2 instance btw) on another application using the same credentials.
When I specify a connection url within the config, I get a NullPointer Exception thrown by the jar stating the serverName
could not be found.
Would you perhaps know what's wrong?
Hello,
i got this PHP code which calls a program (and works still fine):
$sql = "call reppgm.rkm0125('12', '34', '123456', '78', 'ABCDEF', 'RAUE102', '', '', '')";
$this->db->execQuery($sql);
and i tried to translate it to a node-jt400 program:
const myProgram = pool.defineProgram({
programName: "RKM0125",
paramsSchema: [
{type: "CHAR", precision: 2, scale: 0, name: "Firma"},
{type: "CHAR", precision: 2, scale: 0, name: "Filiale"},
{type: "CHAR", precision: 6, scale: 0, name: "AuftragNr"},
{type: "CHAR", precision: 2, scale: 0, name: "AuftragFg"},
{type: "CHAR", precision: 6, scale: 0, name: "Herkunft"},
{type: "CHAR", precision: 10, scale: 0, name: "Programmname"},
{type: "CHAR", precision: 6, scale: 0, name: "ReturnCode"},
{type: "CHAR", precision: 50, scale: 0, name: "ReturnText"},
{type: "CHAR", precision: 10, scale: 0, name: "User"},
],
libraryName: "REPPGM",
});
myProgram({
Firma: "12",
Filiale: "34",
AuftragNr: "123456",
AuftragFg: "78",
Herkunft: "ABCDEF",
Programmname: "RAUE102",
ReturnCode: "",
ReturnText: "",
User: "",
})
.then((result) => {
[...]
})
.catch((err) => {
[...]
});
But all i get is this error:
[Error: Error running instance method
com.ibm.as400.access.ConnectionDroppedException: Connection was dropped unexpectedly.
at com.ibm.as400.access.ClientAccessDataStream.construct(ClientAccessDataStream.java:62)
at com.ibm.as400.access.AS400ThreadedServer.run(AS400ThreadedServer.java:357)
at java.lang.Thread.run(Thread.java:748)
] {
cause: nodeJava_com_ibm_as400_access_ConnectionDroppedException {}
}
if i set the timeout to 0, no answer is returned, multiple normal queries are working before and after
If you try to npm install on a linux machine (centos 7 in my case) with nodejs 12.6 installed it not works. I don't know if it is a known problem or what. Removing node 12 and installing node 10.16 on the same machine without any other modifications it works. It's not a big problem I use 10 but maybe its good to know since 12 will be start to be lts in a few months 😉
I get build errors like
/src/java.cpp:573:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:142:25: error: ‘argv’ was not declared in this scope
v8::Handlev8::Value argv[2];
^
../src/java.cpp:573:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::callStaticMethodSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:600:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:600:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:601:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:601:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::callMethodSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:647:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:647:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::callMethod(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:687:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:687:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(methodName);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/utils.h:141:3: error: ‘Handle’ is not a member of ‘v8’
v8::Handlev8::Value error = javaExceptionToV8(JAVA, env, errStr.str());
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:141:23: error: expected primary-expression before ‘>’ token
v8::Handlev8::Value error = javaExceptionToV8(JAVA, env, errStr.str());
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:141:25: error: ‘error’ was not declared in this scope
v8::Handlev8::Value error = javaExceptionToV8(JAVA, env, errStr.str());
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:142:3: error: ‘Handle’ is not a member of ‘v8’
v8::Handlev8::Value argv[2];
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:142:23: error: expected primary-expression before ‘>’ token
v8::Handlev8::Value argv[2];
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/utils.h:142:25: error: ‘argv’ was not declared in this scope
v8::Handlev8::Value argv[2];
^
../src/java.cpp:698:5: note: in expansion of macro ‘EXCEPTION_CALL_CALLBACK’
EXCEPTION_CALL_CALLBACK(self, msg);
^
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::findClassSync(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:724:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:724:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::newArray(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:753:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:753:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
../src/java.cpp:768:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:782:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:796:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:810:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:824:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:838:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:852:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:876:50: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value item = arrayObj->Get(i);
^
../src/java.cpp:881:42: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::Value&)’
v8::String::Utf8Value valStr(item);
^
../src/java.cpp:881:42: note: candidate is:
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::newChar(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/java.cpp:999:51: error: no matching function for call to ‘v8::Value::ToString()’
v8::Localv8::String val = info[0]->ToString();
^
../src/java.cpp:999:51: note: candidates are:
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2528:44: note: v8::MaybeLocalv8::String v8::Value::ToString(v8::Localv8::Context) const
V8_WARN_UNUSED_RESULT MaybeLocal ToString(
^
/root/.node-gyp/12.6.0/include/node/v8.h:2528:44: note: candidate expects 1 argument, 0 provided
In file included from /root/.node-gyp/12.6.0/include/node/v8-internal.h:14:0,
from /root/.node-gyp/12.6.0/include/node/v8.h:25,
from ../src/java.h:5,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2544:31: note: v8::Localv8::String v8::Value::ToString(v8::Isolate*) const
Local ToString(Isolate* isolate) const);
^
/root/.node-gyp/12.6.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
/root/.node-gyp/12.6.0/include/node/v8.h:2544:31: note: candidate expects 1 argument, 0 provided
Local ToString(Isolate* isolate) const);
^
/root/.node-gyp/12.6.0/include/node/v8config.h:311:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^
../src/java.cpp:1003:64: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
std::string strVal = std::string(v8::String::Utf8Value(val));
^
../src/java.cpp:1003:64: note: candidate is:
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::getStaticFieldValue(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:1081:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:1081:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1082:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(fieldName);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1082:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(fieldName);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::setStaticFieldValue(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:1128:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/utils.h:124:32: note: in expansion of macro ‘ARGS_FRONT_STRING’
#define ARGS_FRONT_CLASSNAME() ARGS_FRONT_STRING(className)
^
../src/java.cpp:1128:3: note: in expansion of macro ‘ARGS_FRONT_CLASSNAME’
ARGS_FRONT_CLASSNAME();
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1129:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(fieldName);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1129:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(fieldName);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/methodCallBaton.h:5:0,
from ../src/javaObject.h:10,
from ../src/java.cpp:7:
../src/java.cpp: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE Java::instanceOf(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/utils.h:120:58: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String&)’
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1189:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(className);
^
../src/utils.h:120:58: note: candidate is:
v8::String::Utf8Value _##ARGNAME##val(##ARGNAME##_obj);
^
../src/java.cpp:1189:3: note: in expansion of macro ‘ARGS_FRONT_STRING’
ARGS_FRONT_STRING(className);
^
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
../src/java.cpp: In function ‘void EIO_AfterCallJs(uv_work_t*)’:
../src/java.cpp:1243:3: error: ‘Handle’ is not a member of ‘v8’
v8::Handlev8::Value* argv;
^
../src/java.cpp:1243:23: error: expected primary-expression before ‘>’ token
v8::Handlev8::Value* argv;
^
../src/java.cpp:1243:26: error: ‘argv’ was not declared in this scope
v8::Handlev8::Value* argv;
^
../src/java.cpp:1250:138: warning: ‘v8::Localv8::Value v8::Object::Get(v8::Localv8::Value)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3412): Use maybe version [-Wdeprecated-declarations]
v8::Localv8::Value fnObj = dynamicProxyDataFunctions->Get(Nan::Newv8::String(dynamicProxyData->methodName.c_str()).ToLocalChecked());
^
../src/java.cpp:1272:14: error: expected type-specifier
argv = new v8::Handlev8::Value[argc];
^
../src/java.cpp:1272:14: error: expected ‘;’
../src/java.cpp:1274:28: warning: ‘v8::Localv8::Value v8::Object::Get(uint32_t)’ is deprecated (declared at /root/.node-gyp/12.6.0/include/node/v8.h:3416): Use maybe version [-Wdeprecated-declarations]
argv[i] = v8Args->Get(i);
^
../src/java.cpp:1280:12: error: type ‘’ argument given to ‘delete’, expected pointer
delete[] argv;
^
../src/java.cpp:1283:60: error: no matching function for call to ‘v8::String::Utf8Value::Utf8Value(v8::Localv8::String)’
v8::String::Utf8Value message(tryCatch.Message()->Get());
^
../src/java.cpp:1283:60: note: candidate is:
In file included from ../src/java.h:5:0,
from ../src/java.cpp:1:
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Localv8::Value)
Utf8Value(Isolate* isolate, Localv8::Value obj);
^
/root/.node-gyp/12.6.0/include/node/v8.h:2995:5: note: candidate expects 2 arguments, 1 provided
make: *** [Release/obj.target/nodejavabridge_bindings/src/java.o] Errore 1
make: Leaving directory/opt/test/node_modules/java/build' gyp ERR! build error gyp ERR! stack Error:
make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:203:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 3.10.0-957.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/test/node_modules/java
gyp ERR! node -v v12.6.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-07-12T09_06_42_417Z-debug.log
When the username or password is incorrect, a window pops up with an error. I am using a purely server-side application which cannot rely on a visual popup blocking any further execution.
Stop the dialog from appearing on bad login credentials
const config = { host: req.hostname, user: req.username, password: req.password };
const pool = require('node-jt400').pool(config);
Trying to determine if possibly a port needs to be opened up via VPN because the connection "seems" to work just fine however when attempting to do a query nothing ever happens. Never fails or responds. I did add trace : true to the connection config and all I am seeing is after connecting and attempting a query.
as400@setString: Properties (2142755619) : trace = "true".
as400@setString: Properties (2142755619) : naming = "system".
as400: ConnectionPool com.ibm.as400.access.AS400JDBCConnectionPool@3fda8085 (1071284357) : Filling the pool with 1 connections..
I am able to connect and query a local IBM i just fine "not going through a VPN" so assuming the VPN is blocking a port but would have assumed then I would get some sort of failure from the query endpoint.
Does anyone have any thoughts? Thanks!
In order to perform a MYSQL "On duplicate Key" in DB2, I do something like this
MERGE INTO TEST AS T
USING (VALUES( 1, 9, 9)) AS DAT(A, B, C)
ON T.A = DAT.A
WHEN MATCHED THEN UPDATE SET T.C = DAT.C
WHEN NOT MATCHED THEN INSERT (A, B, C) VALUES (DAT.A, DAT.B, DAT.C)
Is it possible to perform this using a prepared statement with batchUpdate with something like
pool
.batchUpdate(`
MERGE INTO TEST AS T
USING (VALUES( ?, ?, ?)) AS DAT(A, B, C)
ON T.A = DAT.A
WHEN MATCHED THEN UPDATE SET T.C = DAT.C
WHEN NOT MATCHED THEN INSERT (A, B, C) VALUES (DAT.A, DAT.B, DAT.C)`, data)
.then(result => {
console.log(result);
});
where data looks like
const data = [
[1, 'a', 'c'],
[2, 'b', 'c']
];
I keep running into [SQL0158] Number of columns specified not consistent. I'm sure I could run it by building a string instead of doing a prepared statement, but ya know..SQL injection and all that jazz.
Thanks.
Hello, I'm trying to pass this option on createReadStream
method but I'm getting an error, this is my code:
const readStream = pool.createReadStream(query, { highWaterMark: 32768 });
and this is the error:
TypeError: (params || []).map is not a function at paramsToJson (/app/node_modules/node-jt400/dist/lib/jt400.js:95:42) at Object.obj.createReadStream (/app/node_modules/node-jt400/dist/lib/jt400.js:105:32)
I'm not sure if there's something wrong with my code or how can I increase this highWaterMark since the default value = 16384 is not enough for my?
Here's my test case.
import node-jt400
return undefined.
ES5:
const jt400 = require('node-jt400');
console.log({jt400});
{ jt400:
{ pool: [Function: pool],
connect: [Function: connect],
useInMemoryDb: [Function: useInMemoryDb] } }
ES6:
import jt400 from 'node-jt400';
console.log({jt400});
{ jt400: undefined }
We test node-jt400 for our uses, and are having a problem with big result sets (that is at about 1 million records for a pretty small record size). We get this error:
We couldn't find where we can configure the heap space size for the Java process that is ran internally by the node module. Is there a way to set -Xmx somehow?
Hello guys,
I have problem with the following function, it does not return column names + values, instead it returns an array of column values.
pool.createReadStream("SELECT * FROM FOO")
And then i print the values row by row
stream.on('data', function(data) {
//Returns an array of column values but no column names.
console.log(data);
})
Are there any way to get the column names aswell? As an alternative solution i can create an array with columns i want in my select and value them by index, but yeah... I'm not a fan of that solution lol.
Kindly regards
Hello,
i use this module in a project, and i'm not a java developper.
Is There an easy way to add the method jt400 getdirectory on the pool.ifs() .
Today i use a query select on table ifs_object_statistics db2, but this table are not available on IBMi V7R1 (the version of customer).
I need to get dynamicly the file in folder with subdirectory (i know only the name of files but not the directory).
Sorry for my English (i'm french)
thanks
When I add the require to include node-jt400 in my server.js file I get an error when I run in debugger. When I stop the debugger the output shows the following:
Internal error: TypeError: Cannot read property '0' of undefined
The program '[4060] node.exe' has exited with code -1 (0xffffffff).
Below is all the code I have up to where I declare the require.
var express = require("express");
var app = express();
var bodyParser = require('body-parser');
var mysql = require("mysql");
var renman = require('node-jt400');
When the code shows the error, it's pointing to the line var app = express();. However if I comment out the var renman = require('node-jt400'); line the program works without issue. Am I possible missing something on my machine?
For reference I'm using 5.1.0.0 of Node the above issue.
I down graded to node 4.2.3.0, and now when I run in debug mode with the require not commented out, I get the following error:
Error: Module version mismatch. Expected 46, got 47.
The debugger stops in a module.js file (not sure if that's part of node or node-jt400).
Should update java package dependency to 0.12.1
lodash <4.17.19
Prototype Pollution - https://npmjs.com/advisories/1523
fix available via npm audit fix --force
Will install [email protected], which is a breaking change
node_modules/lodash
java 0.5.2 - 0.12.1
Depends on vulnerable versions of lodash
node_modules/java
node-jt400 >=0.5.3
Depends on vulnerable versions of java
node_modules/node-jt400
Hello,
I am trying to use node-jt400 in order to invoke a program on the AS/400, which has the following structure:
IDENTIFICATION DIVISION.
DATA DIVISION.
PROGRAM-ID. CLIENTDET.
LINKAGE SECTION.
01 CLIENT-NUM PIC 9(8).
01 CLIENT-REC.
02 FIRST-NAME PIC X(16).
02 LAST_NAME PIC X(28).
The above program receives a Client Number and for it returns the Client Name (first and last).
I am not sure how to define the parameters schema in regards to the CLIENT-REC.
I am using the below code:
const myProgram = pool.defineProgram({
programName: 'CLIENTDET',
paramsSchema: [
{ type: 'DECIMAL', precision: 8, scale: 0, name: 'clientNum' },
{ type: 'CHAR' , precision: 16, scale: 0, name: 'firstName' },
{ type: 'CHAR' , precision: 28, scale: 0, name: 'lastName' }
]
});
myProgram(
{
clientNum: 3,
itemName: '',
lastName: ''
}
)
.then(result => {
console.log(result)
}). fail(error => {
console.log(error)
});
And I am getting the below exception:
AS400Message (ID: MCH0802 text: Total parameters passed does not match number required.)
I have tried to invoke the program in the following way also, but did not work either:
myProgram(
{
clientNum: 3,
clientRec: {itemName: '',
lastName: ''}
}
)
.then(result => {
console.log(result)
}). fail(error => {
console.log(error)
});
Could you please advise how I can define the parameters schema and how I can invoke the program?
Mike.
Is this possible when you create the connection? The data I'm connecting to is used on a daily basis, and it would be nice if you could set the connection to be read-only.
export interface BaseConnection {
...
close: () => void;
...
}
in jt400.d.ts would fix this.
Hi ,
When i run a delete on an empty table i got this error message:
name: 'ProgrammerError',
category: 'ProgrammerError',
context: { sql: 'delete from persons', params: [] },
cause:
{ Error: Error running instance method
java.sql.SQLException: Cursor state not valid.
at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:857)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:412)
at com.ibm.as400.access.AS400JDBCPreparedStatement.executeQuery(AS400JDBCPreparedStatement.java:1766)
at nodejt400.JdbcJsonClient.query(Unknown Source)
But is a SQL100 no record found for delete message, is this an issue?
There is a way to get the sql message and the sql id code of the error.
Thank you
S.
Hi,
I need to write into a table which represents file attachments; this table has a BLOB column where I have to write the file itself.
Note that I used to write in the table with pure java code without any problem. Now I need to write from nodejs, using multer as utility to receive files from the web.
I tried to do the query in this ways (as explained in docs):
pool .update('INSERT INTO table (id, attachment) VALUES(?, ?)', [1, {type:'BLOB',value: new Uint8Array(req.files.attachments[0].buffer)}])
or
pool .update('INSERT INTO table (id, attachment) VALUES(?, ?)', [1, {type:'BLOB',value: Uint8Array.from(req.files.attachments[0].buffer)}])
but I get this error
cause: [Error: Error running instance method java.lang.ClassCastException: org.json.simple.JSONObject cannot be cast to java.lang.String at nodejt400.JdbcJsonClient.setParams(Unknown Source) at nodejt400.JdbcJsonClient.update(Unknown Source) at nodejt400.JT400.update(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) ] { cause: nodeJava_java_lang_ClassCastException {} },
So it seems that json in params array is not recognized in the library....
I also tried this:
pool .update('INSERT INTO table (id, attachment) VALUES(?, ?)', [1, {type:'BLOB', value: Uint8Array.from(req.files.attachments[0].buffer).toString()}])
but I get
cause: [Error: Error running instance method java.sql.SQLException: The number of parameter values set or registered does not match the number of parameters. at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:828) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:412) at com.ibm.as400.access.AS400JDBCPreparedStatement.commonExecuteBefore(AS400JDBCPreparedStatement.java:766) at com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:943) at com.ibm.as400.access.AS400JDBCPreparedStatement.executeUpdate(AS400JDBCPreparedStatement.java:1829) at nodejt400.JdbcJsonClient.update(Unknown Source) at nodejt400.JT400.update(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) ] { cause: nodeJava_java_sql_SQLException {} },
So what is the correct way to write the blob starting from a buffer representing a file?
I very need this
thanks
So I encountered an interesting issue, and am looking to gather feedback if it occurs with anyone else.
I added a table in DB2 for i 7.1 that uses the Column name (and System name) "USER".
IBM Data Studio, i Series Navigator can both query that column with a WHERE USER = 'user', however a connection pool query (via Connection
) cannot. The query will return all the results (including the USER column) just fine without the WHERE clause.
At this point am unsure if this is an open-jt400 issue or node-jt400 issue.
-Cody
Hi,
executing query with pool.query returns an object with all values as string:
{
id: "1",
username: "alastyr",
age: "99"
}
Is there any way to return an object without losing database data type? Like this:
{
id: 1,
username: "alastyr",
age: 99
}
Thank you
Hello, is it possible to launch a "batchUpdate", with UPDATE Statements instead of INSERT'S (Like shown in the Examples)
Goal: Performance, not having to run all updates sequencially.
An example for that:
const data = [
[1, 'a'],
[2, 'b']
];
pool
.batchUpdate('UPDATE FOO SET FIELD1 = ? WHERE FIELD2= ?)', data)
.then(result => {
console.log(result);
});
To Make it even more clear - the example shown above would commit two SQL UPDATE STATEMENTS:
UPDATE FOO SET FIELD1 = 1 WHERE FIELD2 = 'a'
UPDATE FOO SET FIELD1 = 2 WHERE FIELD2 = 'b'
I'm executing some complex queries and getting query string with params [], what i'm expecting is Database Exception Response in return.
SELECT * FROM .... params: []
How to check for Error or Response from Server for Exceptions
I noticed there's no pool size setting in Pool class. For better performance and more concurrent connections, shouldn't the pool size be defined to allow for idle/available connections?
this.sqlPool = new AS400JDBCConnectionPool(ds);
sqlPool.fill(10);
Is there any built-in mechanism to convert EBCDIC to ASCII or UTF? If so please let me know.
When calling a program it is not possible to specify the target LIB, the target lib is hardcoded to "*LIBL", it must be a parameter in the funtion.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.