Results 1 to 3 of 3
  1. #1
    ahmed30 is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Default How To insert non-english Strings to Database

    Hello ,

    I need to insert non-english Strings into a database , i am using mysql database, and the non-english text is "arabic"


    Now i set the collation of my database,tables and fields to

    "utf8_general_ci"


    anyway , i have no problem reading from database in to the application.

    it reads arabic text successfully , the problem is when i try to write to the database. the String displays at the database is "??????" instead of the actual text.


    Any Suggestions ?!!

    Thank You for your time

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    See the following link: MySQL :: MySQL 5.0 Reference Manual :: 20.3.4.4 Using Character Sets and Unicode
    It explains that the JDBC Driver for ConnectorJ uses client encoding for data transfer from client to server, so you should specify the encoding using the characterEncoding property in the url, something like:
    Java Code:
    jdbc:mysql://localhost:3306/db_name?useUnicode=yes&characterEncoding=UTF-8

  3. #3
    ahmed30 is offline Member
    Join Date
    Jan 2011
    Posts
    6
    Rep Power
    0

    Default

    Yes , it worked.


    That solved the problem .


    Thank You very much Sir

Similar Threads

  1. insert vector to database
    By jperson in forum JDBC
    Replies: 4
    Last Post: 01-20-2011, 02:42 AM
  2. how to insert data in database
    By Vinay Bhatia in forum JDBC
    Replies: 6
    Last Post: 11-03-2010, 04:06 PM
  3. How to insert random number to database
    By waboke in forum New To Java
    Replies: 1
    Last Post: 09-24-2010, 04:45 PM
  4. why i can't insert data to database
    By khaa_khay in forum Web Frameworks
    Replies: 0
    Last Post: 05-26-2010, 05:37 AM
  5. Replies: 3
    Last Post: 02-28-2009, 09:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •