Problems reading/writing UTF-8 data in MySQL from Java using JDBC connector 5.1

后端 未结 3 1030
[愿得一人]
[愿得一人] 2020-11-30 09:16

I have a scenario with two MySQL databases (in UTF-8), a Java code (a Timer Service) that synchronize both databases (reading form first of them and writing/updating to seco

3条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 09:50

    A little late but this will help you:

    DriverManager.getConnection(
               "jdbc:mysql://" + host + "/" + dbName 
               + "?useUnicode=true&characterEncoding=UTF-8", user, pass);
    

提交回复
热议问题