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

后端 未结 6 1933
逝去的感伤
逝去的感伤 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:32

    On your JDBC connection string, you just need set the charset encoding like this:

    jdbc:mysql://localhost:3306/dbname?characterEncoding=utf8

提交回复
热议问题