Quantcast
Channel: SCN : Discussion List - SAP HANA Cloud Platform Developer Center
Viewing all articles
Browse latest Browse all 3131

SAP HANA Student Trial - Retrieving data from a schema database

$
0
0

Hi,

 

I created my first helloworld.xsjs file in SAP HANA trail version and was successfully able to retrieve data from DUMMY table.

 

Then I created a TEST1 table in NEO_45GGLHBRNEL4HTIE2H0ZR0LUY schema and inserted test values in this table. When  I tried to access the data in this TEST1 table through .xsjs file, I got an error as

 

Found the following errors: =========================== 

InternalError: dberror(Connection.prepareStatement): 258 - insufficient privilege: Not authorized at ptime/query/checker/query_check.cc:2422 (line 12 position 0 in /p1873072661trial/hihanatrial/helloworld/helloworld.xsjs)

 

 

Could you please let me know how can I get access to this table from .xsjs file

 

 

The .xsjs code:

 

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

var output = "Hello World!<br><br>";

 

//Open a database connection

var conn = $.db.getConnection();

 

//var pstmt = conn.prepareStatement("insert into DEV_3NNM3EIKNP8VVHWQNM9CPLF1I.TEST values (1,'A')");

 

//var rs = pstmt.executeQuery();

 

//Prepare a simple SQL statement on the system table "DUMMY"

var pstmt1 = conn.prepareStatement("select * from NEO_45GGLHBRNEL4HTIE2H0ZR0LUY.TEST1");

 

//Execute the query

var rs = pstmt1.executeQuery();

 

//Check the query result

if (!rs.next()) {

    //Something went wrong: Return an error

    $.response.setBody("Failed to retrieve data");

    $.response.status = $.net.http.INTERNAL_SERVER_ERROR;

} else {

    //All went fine: Return the Query result

    output = output + "This is the response from my SQL: " + rs.getString(1);

}

 

//Close the database connection

rs.close();

pstmt.close();

conn.close();

 

//Return the HTML response.

$.response.setBody(output);

 

 

Thanks,

Krishna


Viewing all articles
Browse latest Browse all 3131

Trending Articles