Dataphin中创建API,测试调用报错:"Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Unknown initial character set index '***' received from server. Initial client character set can be forced via the 'characterEncoding' property."

更新时间:

问题描述

Dataphin中创建API,测试调用报错:

{
  "code":500,
  "bizCode":"DPN-OLTP-ENGINE-009",
  "message":"org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested
exception is java.sql.SQLException: Unknown initial character set index '***' received from server. Initial
client character set can be forced via the 'characterEncoding' property.",
  "results":[]
}

问题原因

用户连接的数据源返回的数据初始字符集中编码格式有误,导致报错。

解决方案

在数据源页面选择对应API的数据源修改下配置,JDBC URL加上编码配置即可。

useUnicode=true&characterEncoding=utf8

适用于

  • Dataphin