Encoding converion through JDBC

From: souravm (souravm@infosys.com)
Date: Wed Jun 04 2003 - 00:09:10 EDT

  • Next message: Lisa Moore: "24th Unicode Conference (IUC24) - September 3-5, 2003 - Atlanta, GA"

    Hi All,
     
    I've some query on how JDBC is supposed to convert encoding of
    characters while updating/selecting multibyte strings to/from a Database
    supporting Unicode characters. The specific queries are like -
     
    1. Where from the JDBC driver is supposed to get the encoding of
    the target database instance/database column ? Is there something
    specifically mandated by JDBC specs or left for particular vendor
    implementation ? For example
    - If from a Java client an Oracle DB, having UTF-8 as database
    character set, is being connected, how does JDBC driver know what is the
    database character set ?
    - If from a Java Client a SQL Server 2000 DB instance is
    queried for a nvarchar field (SQL server 2000 always expects nvarchar
    characters to be in UCS-2), how JDBC driver will know that it has to
    send UCS-2 characters
    - If from a Java Client a SQL Server 2000 DB instance is
    queried for a varchar field having encoding type same as the code page
    of the locale of the Windows on which the SQL server is running, how
    JDBC driver will know that it has to send multibyte characters
    corresponding to that code page
     
    2. Can the encoding of the target database instance be specified
    through the JDBC URL ?
    3. Can this encoding be specified through any JDBC API ? (I've not
    found anything when I checked out) ?
    4. How does the encoding of the OS on which the Java Client (which
    does the JDBC connection, select/update etc.) is running affect the JDBC
    query ?
    5. How much of these issues are covered in JDBC specification and
    what are the thing left to the vendor's implementation of JDBC ? Are all
    different type of JDBC drivers (type 1, type 2 , type 3 and type 4)
    supposed to work similar way in this context - is any mandate from JDBC
    specification for this matter ?
     
    At the high level, what I'm looking for are the working principles for
    converting encoding of characters while updating/selecting multibyte
    strings to/from a Database based on JDBC specification (or absence of
    any such thing).
     
    Thanks in advance,
    Sourav
     
     



    This archive was generated by hypermail 2.1.5 : Wed Jun 04 2003 - 01:12:01 EDT