首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >简体字和繁体字都储存在?在Spring项目中使用Liquibase的Sybase数据库

简体字和繁体字都储存在?在Spring项目中使用Liquibase的Sybase数据库
EN

Stack Overflow用户
提问于 2019-07-30 12:09:27
回答 2查看 484关注 0票数 1

我试图用Liquibase在Sybase数据库中保存汉字,但最终得到了"?“每一个角色。我提到了this

但没什么用。

我正在使用3.6.1版本的液基核心(也尝试了3.6.3)

代码语言:javascript
复制
  <dependency>
      <groupId>org.liquibase</groupId>
      <artifactId>liquibase-core</artifactId>
      <version>3.6.1</version>
  </dependency>

以下是创建和插入脚本CREATE的内容:

代码语言:javascript
复制
<?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>

插入查询:

代码语言:javascript
复制
<?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。

任何帮助都是非常感谢的。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-08-01 13:17:59

解决方案在DB连接参数中。

jdbc:sybase:host:port?useUnicode=true&CHARSET=utf8

票数 1
EN

Stack Overflow用户

发布于 2019-07-30 22:50:46

除了没有指定使用哪种Sybase数据库类型(有3种不同的Sybase数据库产品)之外,您正在显示的是事物的客户端。同样重要的是,服务器是否设置为支持Unicode字符(各种方法)。这就是你需要知道的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57271323

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档