cancel
Showing results for 
Search instead for 
Did you mean: 

HANA 2.0 - Create table from Node.js module with hdbext

former_member231229
Participant
0 Kudos

Hello everyone,
I am experiencing the most common error but I am not able to understand why I am falling into that.
Maybe I am missing a very simple point, but here's the scenario:

I have a Node.js module running in an HANA 2.0SPS01 application which is connecting to an external - non HANA - OData Service, loads the metadata for specific entities and tries to create table(s) on the fly which reflect the structure of the requested entities.

After that, it loads data from the service and stores fetched data inside table(s) created in step 1.

For that, I am using the "normal" sap-hdbext standard module providing DDL statements to create the tables I need.
Notice that I am using the hdb-ext middleware, to have the hdb module injected and available to each request.

        // Setup HDB Client:
        app.use(xsHdb.middleware(xsEnv.getServices({
            hana: process.env.HANA_SERVICE_NAME || {
                tag: "hana"
            }
        }).hana));

However, everytime I invoke the db.exec() method by providing the DDL statement (which is something like CREATE TABLE "<Context>.<TableName>" (<Columns>)...) I always receive a "Insufficient privileges: Unauthorized" error.

The schema name is not specified, as it's determination is part of the hdb-ext module loading, as well as the connection to the database which is automatically created by the module using the HDI container technical user.

What could be the reason of the authorization issue? The client is perfectly able to execute DML statements, but no DDL ones.

Is there something I am missing/forgetting while working with HDI containers?

Thanks,

Roberto.

Accepted Solutions (1)

Accepted Solutions (1)

carlsoane
Participant
0 Kudos

Hello Roberto:

I wonder if you need to add a create table privilege to your hdbrole. Step 9 of this tutorial, https://www.sap.com/developer/tutorials/xsa-hdi-module.html, might be of help.

Regards,

Carl

former_member231229
Participant
0 Kudos

Hello Carl,
Thanks for pointing this out, I forgot to add the "CREATE" privilege in the list of admin privileges.

It works as expected.

Cheers,
Roberto.

Answers (0)