mysql - 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
解决方案
问题最终是数据库将 BLOB 用于 json 而不是 TEXT。改变了,然后我不必再担心这个了。
推荐阅读
- jquery - 用 printArea 配置浏览器的打印 问一个问题
- java - spring security csrf 保护不接受标头或cookie(X-XSRF-token)
- php - 命令不同步,无法计算出正确的代码顺序
- java - 基于表单的身份验证关系“用户”不存在
- linux - 如何使用案例来识别 BASH 脚本中的特定模式
- python - python中的Matlab卡尔曼滤波器
- c# - Register singletons as collection of Interfaces with Prism 7
- powershell - PS脚本一班轮问题
- java - 如何在java中将IP字符串转换为整数数组?
- python - 将 Django 代码(需要 Selenium)部署到 heroku - Python