How can I insert arabic word to mysql database using java

后端 未结 4 2197
时光说笑
时光说笑 2020-12-01 13:34

I have a java application, want to insert arabic words to mysql database, my code looks like

Connection con = null;
    String url = \"jdbc:mysql://localhos         


        
4条回答
  •  眼角桃花
    2020-12-01 14:15

    i faced the same problem but with Chinese data, and it is not only the UTF8 in the db connection is the solution you should also do this:

    Ensure that your MySQL configuration encoding is defined correctly. Add these lines to either my.cnf "in the case if using linux" or my.ini "case you using windows"

    [client] 
    default-character-set=utf8
    
    [mysql]
    default-character-set=utf8
    
    [mysqld]
    default-character-set=utf8
    character-set-server=utf8
    

提交回复
热议问题