JavaWeb存入mysql数据数据中文为?号

最近在做SSM框架的案例时,存入到mybatis的数据中文全部显示为?号


1.检查ide的编码

    我用的idea,设置为utf-8。


2.建数据库的时候确认字符集为utf-8,排序方式为utf8_general_ci。


3.连接数据库的文件加上如下连接参数

jdbc.driver = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://xx.xx.xxx.xxxx:3306/examination_system?useUnicode=true&characterEncoding=UTF-8//看这里
jdbc.username = xxxx
jdbc.password = xxxx

猜你喜欢

转载自blog.csdn.net/cijiancao/article/details/79656632