mybatis插入mysql数据中文显示乱码??
下附配置信息,感觉编码已设成同意的utf-8为何还会出现乱码。mybatis的url:url=jdbc:mysql://localhost:3306/ssm?useUni...
下附配置信息,感觉编码已设成同意的utf-8 为何还会出现乱码。
mybatis的url:url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8
数据库建表语句:
SET NAMES utf8;
CREATE DATABASE ssm
CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
use ssm;
CREATE TABLE student(
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '学生id号',
name varchar(30) NOT NULL DEFAULT '' COMMENT '学生名字'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
my.ini配置:
[client]
default-character-set=utf8
port=3306
[mysql]
default-character-set=latin1
# 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]
default-character-set=utf8
# The TCP/IP Port the MySQL Server will listen on
port=3306
...... 展开
mybatis的url:url=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf8
数据库建表语句:
SET NAMES utf8;
CREATE DATABASE ssm
CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
use ssm;
CREATE TABLE student(
id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT '学生id号',
name varchar(30) NOT NULL DEFAULT '' COMMENT '学生名字'
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
my.ini配置:
[client]
default-character-set=utf8
port=3306
[mysql]
default-character-set=latin1
# 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]
default-character-set=utf8
# The TCP/IP Port the MySQL Server will listen on
port=3306
...... 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |