Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
jvx:server:security:db_jndi [2019/03/14 12:00]
admin
jvx:server:security:db_jndi [2019/03/14 12:05]
admin
Line 22: Line 22:
  
 The JNDI resource can be an instance of DBAccess, IConnectionPool,​ java.sql.Connection or javax.sql.DataSource. The JNDI resource can be an instance of DBAccess, IConnectionPool,​ java.sql.Connection or javax.sql.DataSource.
 +
 +The application code, e.g. in your Session LCO
 +
 +<file java>
 +protected DBAccess getDBAccess() throws Exception
 +{
 +    DBAccess dba = (DBAccess)get("​dBAccess"​);​
 +
 +    if (dba == null)
 +    {
 +        DBCredentials dbcred = DBSecurityManager.getCredentials(SessionContext.getCurrentSessionConfig());​
 +
 +        //no credentials -> no database access possible (should not happen, only if configuration is not finished)
 +        if (dbcred != null)
 +        {
 +            dba = DBAccess.getDBAccess(dbcred);​
 +            dba.open();
 +
 +            put("​dBAccess",​ dba);
 +        }
 +    }
 +
 +    return dba;
 +}
 +</​file>​
 +will work without changes.
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information