Hi,
I'm getting a very strange parsing error for a TIMESTAMP value that should be completely normal, and in fact it works in the IDE, this only occurs when I run the script on the command line in Gradle.
My code is in Groovy. It is essentially running a query on an Oracle database, then inserting the results into a H2 database for reporting.
The whole thing is:
Caused by: org.h2.jdbc.JdbcSQLException: Cannot parse "TIMESTAMP" constant "aced0005737200146f7261636c652e73716c2e54494d455354414d50917795c29955641f020000787200106f7261636c652e73716c2e446174756d4078f514a362286f0200015b0004646174617400025b427870757200025b42acf317f8060854e002000078700000000b7872040b0e29101f9f8138"; SQL statement:
INSERT INTO EVENTS(EV_ID, OPERATION_REFERENCE,CREATION_DATE_DB,CREATION_DATE_APP,.....) -- (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13, ?14, ?15, ?16, ?17, ?18, ?19, ?20, ?21, ?22, ?23, ?24, ?25, ?26, ?27, ?28) [22007-175]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
at org.h2.message.DbException.get(DbException.java:161)
at org.h2.value.ValueTimestamp.parse(ValueTimestamp.java:87)
at org.h2.value.Value.convertTo(Value.java:843)
at org.h2.table.Column.convert(Column.java:145)
at org.h2.command.dml.Insert.insertRows(Insert.java:144)
at org.h2.command.dml.Insert.update(Insert.java:115)
at org.h2.command.CommandContainer.update(CommandContainer.java:79)
at org.h2.command.Command.executeUpdate(Command.java:253)
at org.h2.jdbc.JdbcPreparedStatement.execute(JdbcPreparedStatement.java:193)
I even added some debugging output to ensure the value being passed was sane:
CREATION_DATE_APP: 2014-04-11 13:40:15.528
CREATION_DATE_DB: 2014-04-11 13:40:15.530547
CREATION_DATE_DB timestampValue: 2014-04-11 13:40:15.530547
CREATION_DATE_APP timestampValue.time: 1397187615528
CREATION_DATE_DB timestampValue.time: 1397187615530
CREATION_DATE_DB fixed: 2014-04-11 13:40:15.530
and either the plain or "fixed" (parsed by SimpleDateFormat to remove nanoseconds) version gives the same error.
The problem essentially seems to be that the values are getting mangled at some point, perhaps being interpreted as a different encoding, having been passed a map of values. The crux of the insert statement is:
def insertStmt = "INSERT INTO EVENTS(EV_ID, " +
"OPERATION_REFERENCE,CREATION_DATE_DB,CREATION_DATE_APP,....) VALUES ( :EV_ID, " +
":OPERATION_REFERENCE,:CREATION_DATE_DB,:CREATION_DATE_APP,.....)"
The only TIMESTAMP values are the CREATION_DATE_* ones.
Has anyone seen anything like this, do you have any suggestions or things to try?
TIA,
Joel