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

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.050 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.