I have a multi threaded program which connects to a oracle database.
The first thread executes a "big" query and loads the objects in to a LinkedBlockingQueue. There are around 200,000 objects.
The second thread polls this list, and for each object, it runs 14 other queries, updating the object parameters. Then I connect to another database, one final time, get corresponding object for this current object, create a hybrid object containing these two objects and sends it to third thread.
I am using a single statement and multiple result sets for each one of these 14 queries.
stat=predefinedobject.getConnection().createStatement();
ResultSet rs = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
ResultSet rs3 = null;
.
.
rs=stat.executeQuery(Query1);
while(rs.next()) {
object1.setParameter1(rs.getString(5));
}
SqlUtils.closeResultSet(rs);
rs1=stat.executeQuery(Query2);
while(rs1.next()) {
object1.setParameter2(rs1.getString(5));
}
SqlUtils.closeResultSet(rs1);
.
.
.
SqlUtils.closeResultSet(rs14);
SqlUtils.closeResultSet(stat);
I am getting the null pointer exception after some time.
java.lang.NullPointerException
at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:876)
at oracle.jdbc.driver.T4CStatement.executeForDescribe(T4CStatement.java:825)
at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1049)
at oracle.jdbc.driver.T4CStatement.executeMaybeDescribe(T4CStatement.java:845)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1154)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1313)
SqlUtils.closeResultSetignores exceptions that might be relevant leading to an inconsistent state inside the driver (which would still be a bug in the driver). I suggest you 1) check the driver version and upgrade to the latest, 2) check if your utility method ignores exceptions and see if any are occurring there.