I am running mysql 5.5 using the mysql 5.1.18 connector. simple style request
select * from my_table where column_a in ('aaa','bbb',...) and column b=1;
executed from a java application. the query returns a result set of 25 thousand rows, with 8 columns each. when reading results in a while loop
while(rs.next()) { MyObject c= new MyObject(); c.setA(rs.getString("A")); c.setB(rs.getString("B")); c.setC(rs.getString("C")); ... }
the following exception occurs, usually during the first cycles, but never on a single line:
java.lang.NullPointerException at com.mysql.jdbc.ResultSetImpl.getStringInternal(ResultSetImpl.java:5720) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5570) at com.mysql.jdbc.ResultSetImpl.getString(ResultSetImpl.java:5610)
I took a look at the source code in ResultSetImpl.java:5720 and I see the following:
switch (metadata.getSQLType())
where is the metadata
Field metadata = this.fields[internalColumnIndex];
and getSQLType is a non-logical receiver returning an int. what is interesting is that the same metadata object is repeatedly called several lines above with other getters and does not exclude any exceptions.
btw, the problem with the query above when starting directly in mysql. the application works in aws.
any ideas how to solve this? thanks.
source share