× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.






I'm now running V6.9.1 I was able to get the programs at https://www.ibm.com/developerworks/ibmi/library/i-native-js-app-ibmi-with-nodejs/index.html working with a couple of modifications.
I had to remove the stmt.close() and dbconn.close() statements. I'm not sure why it doesn't like them though.

Now I'm trying a sample that creates/updates a table, but I'm having a couple of issues here as well, that I cannot resolve.
Code snippet below.

On the create table, the sample originally was create table ${schema}.CUSTOMER..........

I get a sqlstate=42601 sqlcode = -104 token{ not valid

So I replaced the statement to directly use tstmis.

I can get the statement to run with this if I only have the create table statement.

When I add the insert statement, I get an unexpected identifier pointing to the 'Smith' in the values Also, when this statement is added, the table is no longer created.

I appreciate any help.







const db = require('/QOpenSys/QIBM/ProdData/OPS/Node6/os400/db2i/lib/db2a')

const dbconn = new db.dbconn()
dbconn.conn("*LOCAL")
const stmt = new db.dbstmt(dbconn)

const schema = 'TSTMIS'
let sql =
'CREATE TABLE tstmis.CUSTOMER ( \
CUSNUM NUMERIC(6, 0), \
LSTNAM VARCHAR(50), \
INIT CHAR(1), \
STREET VARCHAR(100), \
CITY VARCHAR(100), \
STATE CHAR(2), \
ZIPCOD NUMERIC(5, 0) \
)'

stmt.exec(sql, function(result, err)
{
console.log('error:' + err)
console.log('result:' + result)

sql = 'INSERT INTO tstmis.CUSTOMER VALUES (123,'Smith','L','123 Center','Mankato','MN',56001)'
stmt.exec(sql, function(result,err){
console.log('error:' + err)
console.log('result:' + result)


})
})

NOTICE: This message, including any attachment, is intended as a confidential and privileged communication. If you have received this message in error, or are not the named recipient(s), please immediately notify the sender and delete this message.

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.