How can I insert arabic word to mysql database using java

后端 未结 4 2200
时光说笑
时光说笑 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 13:54

    You have to create your database as a UTF-8 table otherwise no matter what you add it will never be able to store it...

    second you need to encode it before you save it, I like to use unicode... one thing about this is that if you have a column that specifies 32 length, you will have to increase that for unicode as a single character takes up 6 characters,

    example

    letter h appears as U+0068

提交回复
热议问题