Has anyone seen this NPE in Oracle JDBC driver?

2019-08-12 04:28发布

问题:

We are going to be tracing the driver soon probably, but I wonder if someone has seen this. Some (3rd-party-library) code performs rs.next() on a resultset obtained from Oracle JDBC driver, and then calls rs.getLong() to get a long from a NUMBER column. All of this was working just fine for variety of versions of Oracle, JDBC, OSes, etc. for years, but on a particular machine, with Oracle 12.1.0.2 and ojdbc7 jar for that exact version (12.1.0.2, from http://www.oracle.com/technetwork/database/features/jdbc/default-2280470.html), the following exception happens:

java.lang.NullPointerException
    at java.lang.System.arraycopy(Native Method)
    at oracle.jdbc.driver.DynamicByteArray.get(DynamicByteArray.java:350)
    at oracle.jdbc.driver.NumberCommonAccessor.getLong(NumberCommonAccessor.java:546)
    at oracle.jdbc.driver.GeneratedStatement.getLong(GeneratedStatement.java:228)
    at oracle.jdbc.driver.GeneratedScrollableResultSet.getLong(GeneratedScrollableResultSet.java:564)

Unfortunately ojdbc is not open source. Is this a known issue? Is there some alternative jdbc driver to try?

回答1:

Which version of the Oracle JDBC thin driver are you using? There was a bug that produced an exception similar to yours in version 12.1.0.1. It was fixed in 12.1.0.2. So it looks like an upgrade of your driver might resolve your problem.