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 MAIN { 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 static Vector vInputQueries; public static int tempSize; private PopulateCache ppc; public MAIN() { /* 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) { } // The input file that contains a stream of queries. // Actually these queries come from Semantic Caching Module // where they are massaged in such a way that they can either be executed locally // against the cache, or can be executed remotely 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 { 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 { new MAIN(); // call the constructor... very important ExecutionModule EM = new ExecutionModule(); // this will go in constructor ReplacementModule RM = new ReplacementModule(); // number of queries to be executed is dependent on the value in the properties file int size; size = (tempSize == -1) ? (vInputQueries.size()) : (tempSize) ; for( int i=0;i