Skip to Content
avatar image
Former Member

Retrieving data from table with XSJS

I'm trying to execute a SQL query with XSJS.

I followed all steps here: SAP HANA Cloud Platform

and was able to successfully execute the example provided in "7. Create the JavaScript File". I even got a result:

Hello, P123456789.

This is the response from my SQL. The current user is: P123456789

But now I want to read some data from a table. I changed the code to this:

$.response.contentType = "text/html";
var output;
var conn = $.db.getConnection();
var pstmt = conn.prepareStatement('SELECT * FROM "NEO_123456789ABCDEF"."MYTABLE1"');
var rs = pstmt.executeQuery();
if (! {
    $.response.setBody( "Failed to retrieve data" );
    $.response.status = $.net.http.INTERNAL_SERVER_ERROR;
else {
    output = rs.getString(1);

But I get the following error:

InternalError: dberror(Connection.prepareStatement): 258 - insufficient privilege: Not authorized at ptime/query/checker/ (line 4 position 0 in /p123456789trial/instance1/test/myxsproject/script1.xsjs)

Of course, I also followed the steps "6. Create the Application Descriptors and Role" and "8. Grant the Role to the User".

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 27, 2015 at 02:21 PM

    Try giving the Select,update and execute privilege to SYS_REPO user for you schema

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 13, 2016 at 09:28 AM


         I am facing the same problem . Not very sure whether to create a sqlcc file or assign roles to sys_repo for my schema. Were you able to solve this issue ? Any help would be very much appreciated 😊


    Add comment
    10|10000 characters needed characters exceeded