1. 程式人生 > >關於JAVA往MYSQL寫入中文,SQLyog顯示為問號的解決方法。

關於JAVA往MYSQL寫入中文,SQLyog顯示為問號的解決方法。

在hibernate.cfg.xml檔案中原始碼:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"><hibernate-configuration><session-factory> <property name="hibernate.connection.username">root</property> <property name="hibernate.connection.password">hadoop</property> <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/itcast0807crm?useUnicode=true&amp;characterEncoding=UTF-8</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> <property name="hibernate.dialcet">org.hibernate.dialect.MySQL5Dialect</property> <property name="hibernate.hbm2ddl.auto">update</property> <property name="hibernate.show_sql">true</property> <mapping resource="cn/itcast/crm/domain/SysUserGroup.hbm.xml"/></session-factory>

</hibernate-configuration>

<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/itcast0807crm的後面插入?useUnicode=true&amp;characterEncoding=UTF-8