Well, let's say you want to target DB2 (not just on the i) then there are a number of DB2 drivers, none of which appear to be officially supported, the most popular one seems to be "ibm_db", however, this doesn't support the retrieval of metadata from a stored procedure call, which is necessary if you wish to communicate back to the webservice caller the types and sizes of the parameters and result set columns. IBM do have a native driver I think, which I suspect does allow metadata retrieval, but this then means you have to run your NodeJs server on the IBM i and can't develop it locally and get all the benefits you get on the PC, like a reloading development server when the code changes and a nice debugger (I've not tried using a remote debugger on IBM Node, which might make debugging a bit less painful). In Java EE, I can develop on my PC in the IDE, run a Tomcat instance locally and use a local copy of DB2, MySQL or whatever, or even point to my IBM i just by providing the right JDBC driver and connection options - my code stays exactly the same. This also means that simply by providing different DB connection resources in TomEE the same webservice can execute SPs on completely different databases seamlessly.

Coming back to Node, if you look up drivers for SQL Server, for example, there don't seem to be any officially supported ones. Furthermore, the APIs for each driver are often completely different so you have to write specific code for each database, or worse still, driver that you wish to use. Also, TomEE has a build in database connection pooling facility, in Node on the other hand, some drivers have it, some not, then you have to find your own pooling solution.

If anyone knows better or I've missed something obvious I'd love to know, as I said, I'd prefer to rewrite my framework in Typescript and run it under Node then I have all the code under one roof as it were, but it just doesn't seem that straightforward.



________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx> on behalf of Justin Taylor <JUSTIN@xxxxxxxxxxxxx>
Sent: 16 March 2018 15:45
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] What forum is best for a Tope and Node question?

" unfortunately and relational database support in Node is a little bit poor in general"

Can you elaborate? I have a proof-of-concept Node app running natively that accesses Db2 & SQL Server. It seemed to work OK for me.




-----Original Message-----
From: Tim Fathers [mailto:X700-IX2J@xxxxxxxxxxx]
Sent: Friday, March 16, 2018 9:04 AM
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxx>
Subject: Re: [WEB400] What forum is best for a Tope and Node question?

I'm afraid I can't help you much but my impression is that Node and IBM is somewhat experimental at the moment unfortunately and relational database support in Node is a little bit poor in general. As I mentioned before, my approach was to write a simple Java EE webservice running under Tomcat (TomEE) that allows you to execute a stored procedure via a POST request and return the result, That way all business logic is implemented behind a SP, either pure SQL or RPG or whatever, and there's no need to create webservice endpoints for everything, the API is always the same, just the SP you call is different. TomEE provides a robust framework for doing this which we have found very fast and reliable.

However, because all the front end stuff is Angular and written in Typescript I would really like to rewrite the Java part in Typescript and run it under Node, but so far I've found this not to be quite as easy as I thought, mainly because of patchy support for database drivers, as you're beginning to find out. The JDBC drivers are much more mature and consistent compared to what's available for Node, which often appear to be cobbled together hobby projects. For example, my framework above doesn't have to be used again an IBM i, it can point at any database for which there is a type 4 JDBC driver and the DB API is mostly the same, yet with Node, if I want to target even different flavours of DB2 the drivers are inconsistent, let alone trying to get at SQL Server, MySQL or whatever in a consistent manner. Then not all drivers return complete metadata, some drivers support database connection pooling, other not, some have "basic" support.... For now I've put the Node version o
f he framework on the back-burner but I'd be interested to hear about other people's experiences of Node, my goal is still to one day drop JavaEE.







________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx> on behalf of Kelly Cookson <KCookson@xxxxxxxxxxxx>
Sent: 16 March 2018 14:12
To: Web Enabling the IBM i (AS/400 and iSeries)
Subject: Re: [WEB400] What forum is best for a Tope and Node question?

Thanks for the responses. I finally figured it out. I needed to install the windows build tools:
Npm install windows-build-tools

I must say I am underwhelmed by the node-jt400 module.

1. Not very much in the way of documentation. Google searches turned up a lot of pages with people saying they had the same problem, but offered no fixes or offered suggestions that did not fix the problem. No commercial support available as far as I know.

2. node-jt400 only hides Java from you as long as no errors occur; then you're digging into Java call stacks.

3. I was able to copy a small text file (29 characters) from one IFS directory to another IFS directory. But when I tried to copy a 5MB text file from one IFS directory to another IFS directory, the result was an empty file in the second directory. No error messages or call stack to dig into or anything.

4. The examples provided on node-jt400 npm page for querying a DB2 file and calling a program did not work for me. I have some kind of JDBC error going on with the DB2 query. I'm trying to figure out how to pass the library list for the program. Just passing the program name returns an object not found error despite my user IBM i being set. Passing library/program returns a "not the correct length" error. I'm going to try /QSYS.LIB/MYLIB.LIB/MYPROGRAM.PGM when I get the chance.

I am also a little concerns about scalability if I'm putting Java into the mix. In theory it shouldn't slow down the event loop too much. It passes off the IBM i connection and work to the worker threads. But does Java create overhead opening connections to the IBM i? And it took a second or two to get a return saying the pool was finally closed (i.e., the IFS file was copied) even though the file was only 29 characters long. So I wonder about scalability.

I'm investigating other options.

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
217-773-4486 ext. 12676
https://nam03.safelinks.protection.outlook.com/?url=www.dotfoods.com&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=pLATGhavSYIh9eHMGpAyeNJgZJi28lDb96OiA1MSabc%3D&reserved=0<https://nam03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dotfoods.com&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=ty8J6bKd%2FG2ar%2Bk3eEUhRnzgR%2BHNz3NxYD%2FEp23sPAs%3D&reserved=0>

From: WEB400 [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Tim Fathers
Sent: Friday, March 16, 2018 3:26 AM
To: Web Enabling the IBM i (AS/400 and iSeries) <web400@xxxxxxxxxxxx>
Subject: [EXTERNAL] Re: [WEB400] What forum is best for a JTOpen and Node question?

What errors are you getting?

Did you actually create a new Node project? You need to do this first using "npm init" inside the folder where your project files are/will be, this will create a "package.json" file for you. I would avoid using spaces in the the folder name, it can cause problems with some Node utilities. If your version of NPM is less than 5.0.0 you should also add "--save" when you install a dependency "npm install node-jt400 --save" (as of version 5 it saves by default), this will update your package.json with the new dependency.

________________________________
From: WEB400 <web400-bounces@xxxxxxxxxxxx<mailto:web400-bounces@xxxxxxxxxxxx>> on behalf of Kelly Cookson <KCookson@xxxxxxxxxxxx<mailto:KCookson@xxxxxxxxxxxx>>
Sent: 16 March 2018 01:31
To: Web Enabling the IBM i (AS/400 and iSeries) (web400@xxxxxxxxxxxx<mailto:web400@xxxxxxxxxxxx>)
Subject: [WEB400] What forum is best for a JTOpen and Node question?

Hi,

I'm not sure what forum is best to ask this question.

I have node running on a Windows machine. I want to install the node-jt400 module (https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fnode-jt400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=Y1ojQ2H68I0D8EWZR%2FBia2%2FSIS5g9KCsktJgAAoJ584%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fnode-jt400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=Y1ojQ2H68I0D8EWZR%2FBia2%2FSIS5g9KCsktJgAAoJ584%3D&reserved=0>).

* The node-jt400 module allows JS scripts to access the JTOpen Java classes.

* The JTOpen Java classes allow remote access to IBM i resources.
So, a JS script running in node on Windows can call an IBM i COBOL program or update a DB2400 file using the JTOpen Java classes under the covers.

I know the install command (npm install node-jt400). But I'm getting errors.

I'm not sure WEB400 is the right place to get help on this. If not, can someone please recommend a better forum?

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
217-773-4486 ext. 12676
https://eur01.safelinks.protection.outlook.com/?url=www.dotfoods.com&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=rkZF5J8IVwMHjUJ96PmgSqA3RGBEVSVpt%2FhKGbJhLkQ%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?url=www.dotfoods.com&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=rkZF5J8IVwMHjUJ96PmgSqA3RGBEVSVpt%2FhKGbJhLkQ%3D&reserved=0><https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dotfoods.com&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=LCmff%2BcPcQSeML%2BggDp%2Biw1kQ9N0o2fNCSSkIK5MQ4o%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.dotfoods.com&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=LCmff%2BcPcQSeML%2B
ggDp%2Biw1kQ9N0o2fNCSSkIK5MQ4o%3D&reserved=0>>

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx<mailto:WEB400@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=byZ5yirxc3flde88h4pvfzNOZRODItI9AyimmZF7yw0%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=byZ5yirxc3flde88h4pvfzNOZRODItI9AyimmZF7yw0%3D&reserved=0>
or email: WEB400-request@xxxxxxxxxxxx<mailto:WEB400-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives at https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=XIFFTXIweBE9hcBQ4%2Bd%2ByEtli2qTp04CDB1KSmuBnKs%3D&reserved=0<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Cee331ad4a0a7400bab5808d58ad55fb5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636567571395935978&sdata=XIFFTXIweBE9hcBQ4%2Bd%2ByEtli2qTp04CDB1KSmuBnKs%3D&reserved=0>.

--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx<mailto:WEB400@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=GN0Jv5YhRonoU69KYB0myx5hhFrIoB1fYyBCem9F7hc%3D&reserved=0<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=GN0Jv5YhRonoU69KYB0myx5hhFrIoB1fYyBCem9F7hc%3D&reserved=0>
or email: WEB400-request@xxxxxxxxxxxx<mailto:WEB400-request@xxxxxxxxxxxx>
Before posting, please take a moment to review the archives at https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=K6yuQcXDEKggaaPfby8r%2FIRKJjJrU0Q9%2BwxKtxfqsTo%3D&reserved=0<https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=K6yuQcXDEKggaaPfby8r%2FIRKJjJrU0Q9%2BwxKtxfqsTo%3D&reserved=0>.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list To post a message email: WEB400@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=GN0Jv5YhRonoU69KYB0myx5hhFrIoB1fYyBCem9F7hc%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7Ce199067071794f856a4808d58b3f9318%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568027517373693&sdata=K6yuQcXDEKggaaPfby8r%2FIRKJjJrU0Q9%2BwxKtxfqsTo%3D&reserved=0.


--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.midrange.com%2Fmailman%2Flistinfo%2Fweb400&data=02%7C01%7C%7C58d65f71195e43491e4208d58b4c9dc3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568083533244380&sdata=eAXUL2WOU0yLXt%2FLCU5Rw9ClsEWnh6MTARyudtbnPHU%3D&reserved=0
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Farchive.midrange.com%2Fweb400&data=02%7C01%7C%7C58d65f71195e43491e4208d58b4c9dc3%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636568083533244380&sdata=pz8hfn3jslBcDZ4UBHfU6v8NEdOhpXDafw1wZA%2FVNhQ%3D&reserved=0.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.