Sample Header Ad - 728x90

Set role for database connection in java (spring boot with multitenancy)

0 votes
0 answers
183 views
For every http request there is tenant identifier based on which the schema is switched (datasource switching). connection.setSchema(tenantIdentifier); Now to secure the data access I am introducing role per schema using below code in my method getConnection () connection.createStatement().execute("SET ROLE " + role); Is there any other alternative way/recommended way to set the role ?
Asked by Subhajit (101 rep)
Nov 7, 2023, 03:37 PM