Description:
When using server-side prepared statements with timestamps, _and_ when asking for an updatable result set, the JDBC driver incorrectly converts the nanos portion of the timestamp when converting to a stringified form, using 0x00 instead of '0', causing parsing to fail.
How to repeat:
public void testConvertedBinaryTimestamp() throws Exception {
PreparedStatement pStmt = null;
try {
this.stmt.executeUpdate("DROP TABLE IF EXISTS testConvertedBinaryTimestamp");
this.stmt.executeUpdate("CREATE TABLE testConvertedBinaryTimestamp (field1 VARCHAR(32), field2 VARCHAR(32), field3 VARCHAR(32), field4 TIMESTAMP)");
this.stmt.executeUpdate("INSERT INTO testConvertedBinaryTimestamp VALUES ('abc', 'def', 'ghi', NOW())");
pStmt = this.conn.prepareStatement("SELECT field1, field2, field3, field4 FROM testConvertedBinaryTimestamp",
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
this.rs = pStmt.executeQuery();
assertTrue(this.rs.next());
this.rs.getObject(4)); // fails if bug exists
} finally {
this.stmt.executeUpdate("DROP TABLE IF EXISTS testConvertedBinaryTimestamp");
}
}