java - Spring operation database displays garbled Chinese characters?
我想大声告诉你
我想大声告诉你 2017-05-16 13:29:37
0
1
488

Operating system: ubuntu
IDE:idea
Database: Mysql
When I use php to operate the database, there is no problem with Chinese display, and Chinese can be displayed normally:

But when I was learning spring and operating the database, question marks would appear in Chinese and could not be displayed normally

The database configuration I wrote in spring

# 在项目初始化时,重新创建数据表
spring.jpa.hibernate.ddl-auto=update
# 指定连接的类型为mysql 连接的地址为:localhost 端口为3306 ,数据为springmvc
spring.datasource.url=jdbc:mysql://localhost:3306/springmvc
# 用户名为root
spring.datasource.username=root
# 密码为空
spring.datasource.password=
# 显示SQL语句
spring.jpa.show-sql=true

My database and idea are both encoded in utf_8. Why does this problem occur?

我想大声告诉你
我想大声告诉你

reply all(1)
習慣沉默

Modification

spring.datasource.url=jdbc:mysql://localhost:3306/springmvc

for

spring.datasource.url=jdbc:mysql://localhost:3306/springmvc?useUnicode=true&characterEncoding=utf-8
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template