Reputation: 91
(Re-posting form SAP Blog) Was trying to integrate an HANA schema and HDI container service in cloud foundry trial version with a JAVA application on cloud foundry, and encountered an error as below:
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: DUMMY
Could anyone help me in understanding, what wrong here? Am I supposed to assign an authorization?
I am just running on Cloud Foundry trial version.
This is our simple connection test program:
@Override
protected void doGet( final HttpServletRequest request, final HttpServletResponse response )
throws IOException
{
logger.info("I am running!");
Context ctx = null;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
try {
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DefaultDB");
con = ds.getConnection( );
stmt = con.createStatement();
rs = stmt.executeQuery("select current_user as myuser from DUMMY");
rs.next();
response.getWriter().append("Served at:").append(rs.getString(1)).append(request.getContextPath());
}catch(NamingException e){
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
and I even created a context.xml
under META-INF
under webapp
.
Am I missing anything over here? Could someone help me in understanding the limitation of HANA on a trial version of Cloud Foundry?
Tried giving SYS.DUMMY
, but still throws an error:
Caused by: org.hsqldb.HsqlException: invalid schema name: SYS
Thanks, Regards, Girish
Upvotes: 0
Views: 516
Reputation: 1032
You can define a synonym for DUMMY in the .hdbsynonym
file which can be used on behalf of an actual SYS.DUMMY
{
"my_namespace.my_db::DUMMY" : {
"target" : {
"schema" : "SYS",
"object" : "DUMMY"
}
}
}
and use it in your procedures or SQL queries like so:
SELECT SESSION_CONTEXT('XS_EMAIL') AS "EMAIL" FROM "my_namespace.my_db::DUMMY";
Note: If you are using earlier version of HANA 2 (< SP3) you would need an additional .hdbgrants
file.
Upvotes: 2