Bug #7715 Timestamps converted incorrectly to strings with SSPS and Upd. Result Sets.

Submitted: 6 Jan 2005 20:33 Modified: 6 Jan 2005 20:58
Reporter: Mark Matthews Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1 and newer OS:
Assigned to: Mark Matthews CPU Architecture:Any

[6 Jan 2005 20:33] Mark Matthews
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");
    	}
    }

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

Page generated in 0.037 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.