h2

H2 started to fail on TO_TIMESTAMP on Windows (MODE=Oracle)


In my project I use Liquibase to populate database for my integration tests.

The database jdbc url: "jdbc:h2:mem:dev;MODE=Oracle"

The development finished at some stage - everything was fine. When I returned to it after a year, my integration tests on Windows stopped working with liquibase.exception.DatabaseException, whose reason is

org.h2.jdbc.JdbcSQLDataException: Function "TO_TIMESTAMP": Invalid date format: 
" Tried to parse one of '[Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sept, Oct, Nov, Dec, ]' 
but failed (may be an internal error?). 
Details: \000a    TO_TIMESTAMP('27-SEP-21 10.00.00.000000000 PM', 'DD-MON-RR HH.MI.SSXFF AM')\000a

Further in the terminal arrows point to month names Sept and SEP.

After changing month in the scripts from SEP to SEPT the tests pass. That is clearly not conformant to TO_TIMESTAMP function in Oracle.

What's more. The problem exist only on Windows. On Ubuntu (our CI) everything builds fine. And when I do the build with the 'fix' from Windows (SEP->SEPT), the tests fail on some assertions. Looks like the scripts do not do what they are supposed to.

Do you have any idea what is wrong and how I could fix it?


Solution

  • H2 uses CLDR from Java, newer versions of CLDR from newer versions of Java have Sept instead of Sep in en_GB locale. This change was introduced in Java 16. So you can either use some older version of Java or some other Locale (such as basic en locale without a country).