Bug #92190 PreparedStatement NullPointerException for timestamp column in where condition
Submitted: 25 Aug 2018 9:22 Modified: 25 Aug 2018 10:23
Reporter: Visruth CV Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.47 OS:Linux
Assigned to: CPU Architecture:Any

[25 Aug 2018 9:22] Visruth CV
Description:
Using prepared statement, execute a query having timestamp column in where condition. Eg: SELECT * FROM table1 WHERE created >= ?. This make this below NPE

java.lang.NullPointerException
        at com.mysql.jdbc.PreparedStatement.setTimestamp(PreparedStatement.java:4241)
        at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3601)
        at com.mysql.jdbc.JDBC42PreparedStatement.setObject(JDBC42PreparedStatement.java:68)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:519)
        at org.apache.commons.dbcp2.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:519)
        at org.apache.commons.dbutils.AbstractQueryRunner.fillStatement(AbstractQueryRunner.java:374)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:386)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:329)

How to repeat:
Using prepared statement, execute a query having timestamp column in where condition.

Eg: SELECT * FROM table1 WHERE created >= ?

Suggested fix:
There is no such issue in mysql-connector-java-5.1.46. It could be a side effect of upgrade.
[25 Aug 2018 10:23] MySQL Verification Team
Hello Visruth CV,

Thank you for the report.
This is most likely duplicate of Bug #92089, please see Bug #92089

thanks,
Umesh