Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Location
    Can Tho, Viet Nam
    Posts
    2

    Unanswered: How to use .NET, Oracle with Unicode Datatype (NCHAR, NVARCHAR2)?

    Hi,

    I'm using .NET to access Oracle DB (with OLEDB Provider for Oracle) and have a trouble that it couldn't work with Unicode Datatype (NCHAR, NVARCHAR2). I couldn't update the DB and according to .NET documents, we can't use OLEDB Provider for Oracle with Unicode Datatype.

    Anyone knows how to use Unicode with Oracle in .NET?

    Thanks for your kindness,
    TCAN.

  2. #2
    Join Date
    Jun 2003
    Posts
    2
    string strConnection = "Provider=OraOLEDB.Oracle;Persist Security Info=False;User ID=user;Password=pass;Data Source=ASPtest";

  3. #3
    Join Date
    Jun 2003
    Location
    Can Tho, Viet Nam
    Posts
    2
    I can connect to Oracle but couldn't update the Unicode Fields (Oracle's N datatype: NCHAR, NVARCHAR).

    When I use OLEDB for Oracle, I found an error that 'Character set mismatch'.

    I tried to use the OracleClient, the above error didn't occur and I can update but it's not exact. When I entered some Unicode character (Vietnamese, Japan,...), it didn't work exactly. Only the strange codes are updated (the Unicode chars appear in '?' chars)

    In the OracleClient docs, it recommend that we set HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEID\NLS_LANG to UTF8 but when I set it, the Oracle Client didn't work. It didn't know this NLS_LANG value.

    Do you know the reason and how to fix it, please show me!
    Thanks, TCAN.

  4. #4
    Join Date
    Jul 2003
    Posts
    1
    The NLS_LANG value should be in the form LANGUAGE_TERRITORY.CHARSET, e.g. AMERICAN_AMERICA.UTF8 for UTF-8 character set in an American context.

    However, I believe the NLS_LANG setting is for CHAR and VARCHAR2 columns and does not apply to NCHAR and NVARCHAR2. I have seen statements on Oracle's web site (http://otn.oracle.com/products/oracl...combined1.html) that seem to imply that you have to use Oracle9i for NCHAR to work "perfectly".

    See http://otn.oracle.com/products/oracl...q_combined.htm for more details on the client registry values for NLS_LANG.

    Using ASP and ADO "dot-old" via the Oracle ODBC driver can be made to work with CHAR and VARCHAR2 columns in an Oracle 8.1.7.x database if the database is using UTF8 as its native character set.

    Hope this helps,

    --Mark


    Originally posted by tcanvn
    In the OracleClient docs, it recommend that we set HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEID\NLS_LANG to UTF8 but when I set it, the Oracle Client didn't work. It didn't know this NLS_LANG value.

Posting Permissions

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