This discussion is archived
2 Replies Latest reply: Oct 25, 2011 4:15 PM by jschellSomeoneStoleMyAlias RSS

JDBC unicode conversion issue

user13109986 Newbie
Currently Being Moderated
Hi All,

My database(Oracle 10g) characterset is set to ISO-8859-6(AR8ISO8859P6) to store arabic characters.
When I query the database, JDBC Converts the data from the database character set to Unicode.
Because of this unicode conversion some of the characters are lost(translated to ?)
I tried both oci and thin..

In JAVA Is there any solution to retrieve the data in database format(without doing any unicode conversion)?
Is there any driver available retrieve the data from oracle in database format( encoding)?

Thanks
  • 1. Re: JDBC unicode conversion issue
    836548 Journeyer
    Currently Being Moderated
    user13109986 wrote:
    Hi All,

    My database(Oracle 10g) characterset is set to ISO-8859-6(AR8ISO8859P6) to store arabic characters.
    When I query the database, JDBC Converts the data from the database character set to Unicode.
    Because of this unicode conversion some of the characters are lost(translated to ?)
    I tried both oci and thin..

    In JAVA Is there any solution to retrieve the data in database format(without doing any unicode conversion)?
    Is there any driver available retrieve the data from oracle in database format( encoding)?

    Thanks
    If you are storing foreign language characters in DB, then it is suggested to store them in UTF-8 format in DB. This (character setting ) should be done while creating the DB.

    Java also supports ISO-8859-6, you need to set the characterset.

    To avoid all this confusion, we store the data in UTF-8 format and while showing we use the same on java side. reason UTF supports many foreign language characters.

    Edit: I think this is cross post and been answered earlier.

    Edited by: 833545 on Oct 25, 2011 12:03 PM
  • 2. Re: JDBC unicode conversion issue
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    user13109986 wrote:
    Hi All,

    My database(Oracle 10g) characterset is set to ISO-8859-6(AR8ISO8859P6) to store arabic characters.
    When I query the database, JDBC Converts the data from the database character set to Unicode.
    Because of this unicode conversion some of the characters are lost(translated to ?)
    I tried both oci and thin..
    Most likely explanation is that you are not configuring the driver correctly
    In JAVA Is there any solution to retrieve the data in database format(without doing any unicode conversion)?
    Java strings are unicode and only unicode so for it to be a string it must be unicode.

    You might be able to get bytes. But since they would have to stay bytes I doubt that is useful.
    Is there any driver available retrieve the data from oracle in database format( encoding)?
    Probably commercial ones. But you would need to configure those as well.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points