H2 failing to process valid MySQL – CONVERT(images.X USING UTF8) as X

At my wit’s end trying to figure this one out. It doesn’t help that “convert” is such a generic word. I have a legacy app with working MySQL, but the database code is untested. I’m trying to add unit tests using an H2 DB. Getting the following error for my query:

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "SELECT ...<verbose query>

When I remove this part of the query, it works: CONVERT(images.USER_DATA USING UTF8) as USER_DATA, though of course other things fail.

Is there a way to get H2 to recognize the CONVERT function or maybe another good way of converting this data?

Test properties:

images.jdbc.url=jdbc:h2:mem:images;MODE=MYSQL;INIT=RUNSCRIPT FROM 'classpath:init.sql'
images.driverClassName=org.h2.Driver

Answer

The problem ended up being that the db was using BLOB for json instead of TEXT. Changed that, then I didn’t have to worry about this anymore.