設定Hibernate串連MySQL資料庫連接池編碼

來源:互聯網
上載者:User

MySQL 串連資料庫時設定編碼

自己用的MySQL資料庫預設編碼為UTF8,而伺服器上的為GBK,寫資料時總是多

<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">
com.mysql.jdbc.Driver
</property>
<property name="connection.url">
jdbc:mysql://localhost:3306/db1?useUnicode=true&amp;characterEncoding=UTF-8
</property>
<property name="connection.username">test</property>
<property name="connection.password">123456</property>
...
</session-factory>
</hibernate-configuration>

Hibernate 的詳細介紹:請點這裡
Hibernate 的:請點這裡

Hibernate 中文手冊 PDF

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.