Problem
While working with the CAP applications, I have came across a situation that a standard HANA cloud user used in CPI cannot perform direct CRUD operations on the tables via the JDBC driver. The CPI will throw the error: insufficient privileges. So, I am writing the blogpost for reference purpose.
Solution
Please follow the below mentioned steps:
- Open the SQL Console of the BTP HANA Cloud by selecting the DBADMIN node.
- Create the User group:
CREATE USERGROUP USERGROUP_NAME
- Creating the User & assigning it to the group: USER_01
CREATE USER USER_01 PASSWORD Password1111 NO FORCE_FIRST_PASSWORD_CHANGE SET USERGROUP USERGROUP_NAME
- Grant the User: USER_01 operator of the group: USERGROUP_NAME
GRANT USERGROUP OPERATOR ON USERGROUP USERGROUP_NAME TO USER_01
- If there is already a user present then please ignore the above steps.
- Now, its time to check the SCHEMA_OWNER.
- Get the SCHEMA name. Add the instance by selecting Instance Type: HDI Container.
- Expand & click on the Tables. Select any table & then double click to open. You will get the SCHEMA name.
- Go to the SAP HANA Cockpit.
- Click on the drop down list & select Security and User Management.
- Under the User & Role Management tile, select the Role Assignment option.
- Select Assign roles to a user. Enter the user.
- Click on the EDIT button & add the roles by providing the SCHEMA name.
- Select & add the role you want. Then, save it.
- Click on the added role to check more details.
- Object Privilege
- Assigned Users
- Now, the user is having access to the SCHEMA.
- That's it.
Now you can use the same user in the CPI for
CRUD operations.
If you want to learn more about the
privileges then please check this
link.
If I have missed something, please feel free to add it in the comment section so that, this post can be useful to others.
References: