Can't store UTF-8 Content in MySQL Using Java PreparedStatement

后端 未结 6 1939
逝去的感伤
逝去的感伤 2020-12-18 07:29

For some strange reason I can\'t seem to add UTF-8 data to my MySQL database. When I enter a non-latin character, it\'s stored as ?????. Everything else is stored fine. S

6条回答
  •  忘掉有多难
    2020-12-18 07:39

    add at the end of your DB connection url - (nothing else needed) ex.

    spring.datasource.url = jdbc:mysql://localhost:3306/dbname?characterEncoding=utf8
    

提交回复
热议问题