IBM / JTOpen

IBM Toolbox for Java, an IBM i communications library
https://ibm.github.io/JTOpen/
Other
60 stars 28 forks source link

Looking for NodeJS examples #182

Closed mklassen60 closed 3 months ago

mklassen60 commented 3 months ago

I am responsible for taking over a legacy project used JT400 v10.4 which was done in NodeJS. The reason to upgrade is we have a program call that returns the data string incorrectly and we are hoping an update fixes that encoding. "status":"ᅤᅮ￉¥ᅤ￙ᅤᅣ€€€€€€€€€€€€€€€€"

The configuration connection is a little bit messy but when trying to do this piece of code it errors out on v11.2+

Works in v10.4

const driverInstance = await java.newInstancePromise('com.ibm.as400.access.AS400JDBCDriver');
        await java.callStaticMethodPromise(
           'java.sql.DriverManager',
            'registerDriver',
            driverInstance
        );

When trying to do any of that code on a newer version we get issues that the class does not exist. It appears it was removed, but I do not see any examples how to use this library with Promises. I assume the previous developer love that idea over the examples I've seen but they are still minimal.

Any references that could assist me in troubleshooting these issues?

kadler commented 3 months ago

This repository doesn't contain any Node.js code whatsoever, only Java. Looks like you are using some kind of Node.js - Java bridge package, so your question about Promise support would be better asked to that project than here.

When trying to do any of that code on a newer version we get issues that the class does not exist. It appears it was removed

Which class are you referring to here? Presumably com.ibm.as400.access.AS400JDBCDriver

mklassen60 commented 3 months ago

I have been banging my head with this all afternoon so I assume a typo somewhere as I was going back and forth in different Jar versions. Now it seems to be working and finds com.ibm.as400.access.AS400JDBCDriver.

It is working with the latest JAR file but I think the encoding issue would be on the IBM i side of things.

EDIT: After review, I was attempting to include the jar file but left out the extension from copying/pasting the .jar which is why the class wasn't found.