import java.sql.*; import java.util.*; import java.io.*; import oracle.jdbc.pool.OracleDataSource; import oracle.jdbc.driver.OracleResultSet; import oracle.sql.ROWID; public class Sept24Cache { private ResultSet result=null; private Statement stmt=null; private Statement stmt2=null; private Connection conn=null; private EstabConn localdb=null; private int count=0; private Vector vInputQueries=null; public static int tempSize=0; private PopulateCache ppc; public Sept24Cache() { try { // specifiy the database name localdb = new EstabConn(); conn = localdb.connectdb(new String("orcl")); stmt = conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); stmt2 = conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); } catch(SQLException ex) { ex.printStackTrace(); System.out.println("Error in establishing connection with the database: in class Sept24Cache"); System.exit(0); } // load all properties from the properties file Properties properties = new Properties(); try { properties.load(new FileInputStream("properties.properties")); } catch (IOException e) { } String sQueryInputFile = properties.getProperty("sQueryInputFile"); String str=null; vInputQueries = new Vector(); tempSize = Integer.parseInt(properties.getProperty("tempSize")); ReadFile rf = new ReadFile(sQueryInputFile); while( (str=rf.readLine()) != null ) { vInputQueries.add(str) ; } rf.close(); ppc = new PopulateCache(); } public void close() { try { //result.close(); this is giving problems while closing ... hence commented stmt.close(); stmt2.close(); conn.close(); localdb.close(); } catch(SQLException ex) { ex.printStackTrace(); System.out.println("Error in closing connection to the database: in class Sept4Cache"); System.exit(0); } } public void InfiniteCache(String sQuery) throws SQLException { System.out.println("Executing query " + sQuery); ResultSet rset = stmt.executeQuery (sQuery); // Move to the end of the result set rset.last(); // Get the row number of the last row which is also the row count int rowCount = rset.getRow(); // call populateCache class methods... ppc.populate(rset,sQuery); } public static void main (String args[]) throws SQLException { ExecutionModule EM = new ExecutionModule(); // this will go in constructor EM.executeUpdate("select rowid, id from hv where id = 10"); EM.close(); /* Original code Sept24Cache sc = new Sept24Cache(); int size; size = (tempSize == -1) ? (sc.vInputQueries.size()) : (tempSize) ; for( int i=0;i