Thursday, July 23, 2020

DataSource Connection

public class DataSourceConnection {

public Connection getOIMDBConnection(String t3url) {
       
                Connection connection = null;
DataSource ds = null;       
                try {
Hashtable env = new Hashtable();                     
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, "weblogic.jndi.WLInitialContextFactory");
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL,t3url);
                       
Context context = new InitialContext(env);
ds = (DataSource) context.lookup("jdbc/operationsDB");
System.out.println( "Successfully looked up OIM datasource : ");
           
if (ds != null) {
                                    conn = ds.getConnection();
    System.out.println("Successfully obtained OIM database connection : ");
}
} catch (Exception e) {
                            System.out.println("Exception while getting DB connection : "+e.getMessage());
                        }         
                        return connection;
}

No comments:

Post a Comment

Fetch Members from Workgroup

  import java.util.ArrayList;   import java.util.Iterator;   import java.util.List;   import sailpoint.api.ObjectUtil;   import sailpoint.ob...