Based on what I've read, I'm not going to get the number of results and store in
an array, I'll just use 2 ArrayLists instead..
I'm still getting my null pointer exception for some reason. It must be
happening inside the rs.next() method when I call it..
My code looks something like this:
rs = stmt.executeQuery("...");
while(rs.next()) {
arrLstS.add(rs.getString("..."));
arrLstS.add(getRoomName(rs.getInt("...")));
arrLstB.add(rows);
}
I caught the exception and did a stack trace but all it said was:
java.lang.NullPointerException
at dbcon.DBCon.getReadings(DBCon.java:308)
at dbcon.DBCon.<init>(LocalDBConnection.java:58)
at dbcon.DBCon.LocalDBConnection.main(LocalDBConnection.java:39)
I've put in some test data and the SQL query should return 2 results. But even
if it didn't return any results, my code just wouldn't go into the while loop. I
don't see why I'm getting a null pointer exception.