Wednesday, October 5, 2016

Run query form java code using OIM Client login

import Thor.API.Security.XLClientSecurityAssociation;
import com.thortech.xl.client.dataobj.tcDataBaseClient;
import com.thortech.xl.dataaccess.tcClientDataAccessException;
import com.thortech.xl.dataaccess.tcDataProvider;
import com.thortech.xl.dataaccess.tcDataSet;
import com.thortech.xl.dataaccess.tcDataSetException;
import com.thortech.xl.orb.dataaccess.tcDataAccessException;

public void connectOIMDB(OIMClient oimClient){
XLClientSecurityAssociation.setClientHandle(oimClient);
tcDataProvider dataProvider = new tcDataBaseClient() ;        
        String query ="SELECT * FROM USR WHERE USR_LOGIN = 'XELSYSADM'";        
  tcDataSet dataSet = new tcDataSet();
  dataSet.setQuery(dataProvider, query);
  dataSet.executeQuery();
  System.out.println("Login ID: "+dataSet.getString("USR_LOGIN"));

}