jmac11 / googlecloudsql

Automatically exported from code.google.com/p/googlecloudsql
0 stars 0 forks source link

dev JDBC queries return zero rows if any of the rows contains a null DATETIME #45

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The appengine Java driver cannot return any rows for a query if any row has a 
"DATETIME default NULL" column that is unset:

  Cannot convert value '0000-00-00 00:00:00' from column 4 to TIMESTAMP

Cloud SQL in production does not have this problem because its default value 
for a null DATETIME is "0002-11-30 00:00:00" instead.

Example:
1  2011-01-02 00:00:00
2  2011-01-03 00:00:00
3  2011-01-04 00:00:00
4  2011-01-05 00:00:00
5  2011-01-06 00:00:00
6  0000-00-00 00:00:00

The query, "SELECT * FROM foo", would fail and not return any rows because the 
driver cannot handle the null DATETIME field.

java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 4 
to TIMESTAMP.
    at com.google.cloud.sql.jdbc.internal.Exceptions.newSqlException(Exceptions.java:215)
    at com.google.cloud.sql.jdbc.internal.SqlProtoClient.check(SqlProtoClient.java:198)
    at com.google.cloud.sql.jdbc.internal.SqlProtoClient.executeSql(SqlProtoClient.java:87)
    at com.google.cloud.sql.jdbc.internal.SqlProtoClient.executeSql(SqlProtoClient.java:76)
    at com.google.cloud.sql.jdbc.Connection.executeSql(Connection.java:528)
    at com.google.cloud.sql.jdbc.Statement.executeSqlImpl(Statement.java:280)
    at com.google.cloud.sql.jdbc.Statement.executeImpl(Statement.java:154)
    at com.google.cloud.sql.jdbc.Statement.execute(Statement.java:142)

Original issue reported on code.google.com by nguyen.hoai.nam@gmail.com on 8 Jul 2012 at 10:34

GoogleCodeExporter commented 9 years ago
Related issue: http://code.google.com/p/googlecloudsql/issues/detail?id=35

Original comment by nguyen.hoai.nam@gmail.com on 8 Jul 2012 at 10:35

GoogleCodeExporter commented 9 years ago

Original comment by rclev...@google.com on 9 Jul 2012 at 5:14