Skip to Content
Oct 18, 2020 at 07:50 AM

Unable to create users in Hana Database Using execBatch()

151 Views Last edit Oct 19, 2020 at 12:28 PM 2 rev

I have an XSA System and XSA Database User. This XSA DB user will be used to create new Hana database users in XSA. I am trying to create a batch of users with the help of execBatch() functionality. I have a cap with node.js project.

I am executing sql queries in my node.js file. Below is the code.

createusersarr is the array which contains the list of users to be created. The array looks like this -


When I run my node app,

It doesnt create the users and the error shown is undefined as below -

ERROR - Targeting User Creation


I am not sure why this is failing? It runs fine when I use exec() instead of execBatch() and provide user name one by one in the create user query (basic loop mechanism).

console.log("Targeting User Creation")
                let createuserstatement = await xsaDbConn.preparePromisified("CREATE USER ? PASSWORD AbcYes NO FORCE_FIRST_PASSWORD_CHANGE")
                await createuserstatement.execBatch(createusersarr)
                console.log(`Users created.`)