I have a MySQL database table on AWS RDS which has a column named upload_date whose TYPE is TIMESTAMP and DEFAULT is current_timestamp.
I’ve done the same thing in my local MySQL db.
When I invoke the rst.getTimestamp(“upload_date”) in my local db connection, it works great.
However when I try the same thing on my AWS RDS MySQL, I get this exception
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1033)
at com.mysql.jdbc.BufferRow.getTimestampFast(BufferRow.java:576)
at com.mysql.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6466)
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6066)
at com.mysql.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6104)
at org.udhc.gen.HealthRecord.getAllUploadedHealthRecords(HealthRecord.java:337)
at org.udhc.gen.HealthRecord.main(HealthRecord.java:858)
Where am I going wrong?
Thanks.
The issue was:
I had ALTERed the table to add this new column – so the previously entered rows had
00-00-00 00:00 ( or something similar )
That caused the above expection.
FIX: