Skip to Content
author's profile photo Former Member
Former Member

insufficient privilege for SQL PREPARE statement

I am using the below statement on the hanatrial.ondemand.com account in an .xsjs script:

pStmt = conn.prepareStatement('insert into "<account>.<package>:Person"("oid", "history.createdAt", "history.createdBy","name", "firstName" ) values (?, now(), ?, now(), ?, ?, ?)');

pStmt.setInteger(1,personOid); // object id

pStmt.setString(2,user);

pStmt.setString(3,user);

pStmt.setString(4,name);

pStmt.setString(5,firstname);

pStmt.execute();

conn.commit();

as a result I am getting the error:

InternalError: dberror(Connection.prepareStatement): 258 - insufficient privilege: Not authorized at ptime/query/checker/query_check.cc:2422 (line 277 position 0....

how can I set the authorization to execute a prepare statement?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 06, 2015 at 09:18 AM

    The solution to the problem was:

    1. create a role in the .xsprivileges file

    {

    "privileges": [{

    "name": "Execute",

    "description": "Basic usage privilege"

    }]

    }

    2. add the sql object permission into the user <role filename>.hdbrole:

    sql object <account>.<package>::Person: SELECT, INSERT, UPDATE,DELETE;

    sql object <account>.<package>::PersonId: SELECT; /* sequence for key generation */

    3. execute

    call HCP.HCP_GRANT_ROLE_TO_USER('<account>.<package>::<role filename>','<user>')

    CALL "HCP"."HCP_GRANT_SELECT_ON_ACTIVATED_OBJECTS"

    4. execute the below if you make changes to the roles

    CALL "HCP"."HCP_SYNCHRONIZE_ROLES"

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      The below example activates correctly:

      1. Table Definition: TABLE1.hdbtable

      table.schemaName = "_SYS_BIC";

      table.tableType = COLUMNSTORE; // ROWSTORE is an alternative value

      table.columns =

      [

      {name = "ID"; sqlType = INTEGER; },

      {name = "NAME"; sqlType = VARCHAR; length = 50; }

      ];

      table.primaryKey.pkcolumns = ["ID"];

      2. Role Definition: helloworld_user.hdrole

      role pxxxxxtrial.ppmcloud.ppm.roles::user {

      sql object pxxxxxtrialtrial.ppmcloud::TABLE1: SELECT, INSERT, UPDATE,DELETE;

      }

  • Posted on Feb 05, 2015 at 11:06 AM

    hi Beat Gut,

    Please Refer this link.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.