Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Error while inserting record from XSJS

Hi,

I have created table using the following definition.

When I insert record from SQL console it is working perfectly.

But when I do the same from XSJS it throws the error as

found the following errors:

===========================

InternalError: dberror(PreparedStatement.execute): 598 - failed to execute the external statement: failed to execute at remote: peer=127.0.0.1:30103: unhandled exception (line 14 position 1 in /tryouts/monissha/projects/poc/services/demo.xsjs)

The xsjs code is as follows,

var conn;

var pstmt;

var rs;

conn = $.db.getConnection();

pstmt = conn.prepareStatement('INSERT INTO  "SAPHANA_ROI"."Scenario" VALUES ("SAPHANA_ROI"."ScenarioId".NEXTVAL, ?, ?, ?)');

pstmt.setString(1, $.session.getUsername());

pstmt.setString(2, '');

pstmt.setString(3, '');

pstmt.execute();

conn.commit();

$.response.setBody(0);

$.response.contentType = "text/html";

pstmt.close();

conn.close();

Help me out in resolving this issue.

Thanks & Regards,

Monissha

Tags:
Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question