I am trying to make an application with threads consult a database with millions of records and basically these threads divide the database to make the query faster. The error that I am having is that in my code only one thread is executed, only one thread makes the query that correspond to it and the other threads, according to the debugger of eclipse the other threads do not pass beyond after assigning the statment to the result.
This is the part where I start the pool of connections and I made the query, the first thread executes this normal and then performs the processing of the result but the other threads do not exceed rs = stmt.executeQuery();
have any idea why this happens?
ConnectionPool connectionPool = new ConnectionPool(
"oracle.jdbc.driver.OracleDriver",
"conexion", "user", "pass",
5, 10, true);
Connection con = connectionPool.getConnection();
String query = "select * " +
"from GLMERCAN.\"GL_TBEVENTS\" " +
"where INSERTDATE >= trunc(sysdate-1) and INSERTDATE <= trunc(sysdate) AND ROWNUM > "+inf+" AND ROWNUM < "+sup;
System.out.println(query);
PreparedStatement stmt = con.prepareStatement (query); // Create a Statement
ResultSet rs = null;
rs = stmt.executeQuery();