Menu

#25 Invalid SQL when exporting for H2 dialect

v1.0_(example)
pending-fixed
nobody
None
5
2018-05-15
2018-05-07
No

When I export data from an SQL Server instance to an H2 formatted script (the goal being to run integration tests off of a data subset), the resultant script does not escape timestamp columns properly, causing syntax errors.

The problem appears to occur when using a source database with a datetimeoffset column. These result in unescaped timestamps. Interestingly, datetime2 columns in the source have no difficulty.

The result is scripts that look something like:

Insert into A.Table(ID, OffsetbasedDate, Datetime2Date) values (2865570, 2018-05-15 13:00:00 -06:00,'2018-05-07 04:17:18.113')

The latter value parses correctly as a datetime in H2, but the former errors out on format even when quoting the output.

Discussion

  • Ralf Wisser

    Ralf Wisser - 2018-05-08

    This seems to be a bug in the JTDS driver, as it works with the Microsoft JDBC driver.

     
  • Ralf Wisser

    Ralf Wisser - 2018-05-08

    I did some further tests and found out that using the Microsoft JDBC driver doesn't solve the problem entirely.
    I've attached a patch (based on release 7.8.2) that hopefully solves the issue. Please replace the file "jailer.jar" with the attached one.

     
  • Michael McDermott

    The patched JAR works perfectly. Thanks!

     
  • Ralf Wisser

    Ralf Wisser - 2018-05-15
    • status: open --> pending-fixed
     
  • Ralf Wisser

    Ralf Wisser - 2018-05-15

    Fixed in release 7.9

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB