Bug #75240 Fabric-specific NPE when supplying java.util.Date in PreparedStatement
Submitted: 16 Dec 2014 21:56 Modified: 28 Feb 2015 1:03
Reporter: John Krieger Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.34 OS:Windows
Assigned to: Assigned Account CPU Architecture:Any

[16 Dec 2014 21:56] John Krieger
Description:
Fabric version is 1.5. Output generated by test case follows. This error is manifested only when using a fabric URL.

Attempting to open connection
DriverManager.getConnection("jdbc:mysql:fabric:<URL truncated>")
    trying com.mysql.jdbc.Driver
    trying com.mysql.fabric.jdbc.FabricMySQLDriver
getConnection returning com.mysql.fabric.jdbc.FabricMySQLDriver
Finished getConnection
java.lang.NullPointerException
        at com.mysql.jdbc.PreparedStatement.setTimestampInternal(PreparedStatement.java:4292)
        at com.mysql.jdbc.PreparedStatement.setTimestamp(PreparedStatement.java:4262)
        at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:3623)
        at DateTest.main(DateTest.java:22)

How to repeat:
- Create a table with at least one DATETIME column. Example schema has one DATETIME column and one mediumint column.
- Modify the prepared statement in the test case to reflect the schema as needed.
- Run the test case supplying the URL, ID and password as arguments.

Suggested fix:
Workaround is to use java.sql.Date (in which case setDate can be used).
[17 Dec 2014 1:13] John Krieger
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b18)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
[28 Feb 2015 1:03] Jess Balint
This is a duplicate of Bug#75080 which will be fixed in the 5.1.35 release.