import java.sql.*; import java.util.Iterator; import java.util.Map; import java.util.Collection; import javax.security.auth.Subject; import com.adeptia.indigo.security.AuthUtil; import com.adeptia.indigo.services.transport.connector.DatabaseConnectionInfo; import com.adeptia.indigo.storage.Entity; import com.adeptia.indigo.storage.EntityManager; import com.adeptia.indigo.storage.EntityManagerFactory; import com.adeptia.indigo.storage.StorageException; import com.adeptia.indigo.utils.IndigoException; import com.adeptia.indigo.utils.JdbcUtils; import com.adeptia.indigo.utils.HandleJTADBConnection; //Logic to clear connection pool Map conMap = HandleJTADBConnection.getConnectionMap(); conMap.clear(); String deleteRecordsQuery="delete from EMPDetails"; Connection _con = null; Subject _subject = AuthUtil.getAdminSubject(); DatabaseConnectionInfo dbInfo = null ; Entity beanObject1 = (Entity) DatabaseConnectionInfo.class.newInstance(); EntityManager entityManager1 = EntityManagerFactory.getEntityManager( beanObject1.getClass() , _subject ); Iterator it = entityManager1.retrieve(); while( it.hasNext() ) { DatabaseConnectionInfo temp = (DatabaseConnectionInfo) it.next() ; String entityId = temp.getId() ; if( entityId.equals( "192168001218123865633367100084") ) { dbInfo = temp ; break ; } } _con = JdbcUtils.getConnection(dbInfo , _subject ); Statement _statement = _con.createStatement() ; _statement.execute(deleteRecordsQuery) ; _statement .close(); _con.close();