cancel
Showing results for 
Search instead for 
Did you mean: 

DDL Privileges for Spring Boot Application in XS Java (XSA)

0 Kudos

Hello experts,

We are trying implementing an solution on xs advance, which is an on premise system using "Spring Boot" as our application layer. We were good until we encountered an situation where we need to to fire an DDL statement form application layer,

here is the code:

private String createTable(Connection conn, String tableName, String[] columns, String defaultDataType) throws SQLException {
  	List<String> tableColumn = new ArrayList<String>();
  	StringBuilder createStmt = new StringBuilder();
  	
    for(String column: columns){
    	tableColumn.add("\""+column+"\" "+defaultDataType);
    }
    
    createStmt.append("CREATE COLUMN TABLE ")
    			.append(tableName)
    			.append("(")
    			.append(String.join(", ", tableColumn))
    			.append(");")
    			;
    			
    PreparedStatement prepareStatement = conn.prepareStatement(createStmt.toString());
    ResultSet resultSet = prepareStatement.executeQuery();
    return isCreated(resultSet);
  }

and here is the code that gets hdi connection to application layer

  private Connection getConnection() throws SQLException {
    VcapServices services = VcapServices.fromEnvironment();
    Service service = services.findService("hana", "", "");
    if (service == null) {
      return null;
    }

    Credentials credentials = service.getCredentials();
    DataSourceSAP dataSource = new DataSourceSAP();

    dataSource.setUser(credentials.getUser());
    dataSource.setPassword(credentials.getPassword());
    dataSource.setPort(Integer.parseInt(credentials.getPort()));
    dataSource.setServerName(credentials.getHost());


    return dataSource.getConnection();
  }

When we fire DDL statements, It says "insufficient privilege: Not authorized", as its using application_user privileges

So is there any way to suppress this and use object_owner privileges? or to grant "ddl" permission for application_user? (or like enabling anonymous user)

and

How do we add Security for Spring Boot Application with HANA credentials? Most of the online document speaks about Spring Web Security 😞

is there any way to obtain JWT token from XSA UAA service? CF document says api- oauth/token will provide us the token from UAA service, But with XSA it didn't work.

Thank you

Accepted Solutions (0)

Answers (0)