Struts&MYSQL中文乱码..依旧有问题...
来源:百度知道 编辑:UC知道 时间:2024/06/04 10:15:40
我去,一试又好了,为什么呢,今天在两台机器上同样的配置都出现问题,现在我什么都没改一台机器上又好了
1:你建库的时候加上编码格式,这样就不用改my.ini了。。crate database db1 set character gb2312;
2:hibernate连接写法jdbc:mysql://localhost:3306/db1?useUnicode=true&characterEncoding=bk2312
试下。。应该可以的
INI 文件上 有2个地方 都改成 GB2312
[client]
port=3306
[mysql]
default-character-set=gb2312 -----这里
# SERVER SECTION
# ----------------------------------------------------------------------
#
# The following options will be read by the MySQL Server. Make sure that
# you have installed the server correctly (see above) so it reads this
# file.
#
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306
#Path to installation directory. All paths are usually resolved relative to this.
basedir="C:/Program Files/MySQL/MySQL Server 5.0/"
#Path to the database root
datadir="C:/Program Files/MySQL/MySQL Server 5.0/Data/"
# The defau