我试图用Liquibase在Sybase数据库中保存汉字,但最终得到了"?“每一个角色。我提到了this
但没什么用。
我正在使用3.6.1版本的液基核心(也尝试了3.6.3)
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>3.6.1</version>
</dependency>以下是创建和插入脚本CREATE的内容:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd" >
<changeSet author="me" id="1" >
<createTable tableName="person" >
<column name="name" type="unitext" encoding="utf8" >
</column>
<column name="address" type="VARCHAR(255)" />
</createTable>
<rollback>
<dropTable tableName="person"/>
</rollback>
</changeSet>
</databaseChangeLog>插入查询:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">
<changeSet author="me" id="2" runOnChange="true" >
<insert tableName="person" >
<column name="name" value="汉字" encoding="utf8"/>
<column name="address" value="DNI"/>
</insert>
</changeSet>
当我启动Spring应用程序时,脚本就会被执行。我明白了“?”当我查询表时,代替了"汉字“。
与代码一样,我已经将encoding=utf8放入其中。不知道缺了什么。
Sybase版本: ASE 15。
任何帮助都是非常感谢的。
发布于 2019-08-01 13:17:59
解决方案在DB连接参数中。
jdbc:sybase:host:port?useUnicode=true&CHARSET=utf8
发布于 2019-07-30 22:50:46
除了没有指定使用哪种Sybase数据库类型(有3种不同的Sybase数据库产品)之外,您正在显示的是事物的客户端。同样重要的是,服务器是否设置为支持Unicode字符(各种方法)。这就是你需要知道的。
https://stackoverflow.com/questions/57271323
复制相似问题