Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Unanswered: How to handle multibyte character set from JDBC

    We use DB2V7.2.5 server and client, AIX. Tried to retrieve the Japanese data through JDBC 2.0 without success. I'd like to know what shuold be done on the server side and client side.

    1)Should we change the codeset when we create the database? For example, do this:

    DB2 CREATE DATABASE dbname USING CODESET UTF-8 TERRITORY US

    Besides above, is there anything we should do on the server side?

    2) On the java side, we use the getString method in Java to retrieve the char string from DB2. Is there other things we should do on the client side?

    Thanks.

  2. #2
    Join Date
    Jan 2002
    Posts
    13
    I am not sure why you want to change the character set of the database (It would be already containing your Japanese data right?)

    I must confess that I haven't worked with JDBC but in case of DB2 - CLI, all that is required to be done is setting the DB2CODEPAGE environment variable to an appropriate value without doing any changes on the server side.

    e.g. if your database character set is UTF-8, you could set DB2CODEPAGE to 1208 and the data returned to you by your getString() call would be UTF-8.

    References: http://nscpcw.physics.upenn.edu/db2_...0/db2d0341.htm

    Hope this helps.

    Regards,
    Siddharth.

    P.S. If you have any other queries, you may contact me directly at siddharth@persistent.co.in since I donot check this newsgroup very often

  3. #3
    Join Date
    Dec 2002
    Posts
    2
    Siddharth,

    Thanks. I know use CLI we can retrieve Kanji data(Japanese) by changing the codepage in DB2 client. We tested that already. What we want to know is how to retrieve Japanese data using DB2 application driver. This is provided in db2Java.zip. It is a DB2 driver in Java. According to the Admin guide, we should create a UTF-8 database to store those double byte character so that we can retrieve it correctly via DB2 app driver. In this case, there is NO special codepage set on the client side. Is that true?

    Maggie




    Originally posted by siddharth
    I am not sure why you want to change the character set of the database (It would be already containing your Japanese data right?)

    I must confess that I haven't worked with JDBC but in case of DB2 - CLI, all that is required to be done is setting the DB2CODEPAGE environment variable to an appropriate value without doing any changes on the server side.

    e.g. if your database character set is UTF-8, you could set DB2CODEPAGE to 1208 and the data returned to you by your getString() call would be UTF-8.

    References: http://nscpcw.physics.upenn.edu/db2_...0/db2d0341.htm

    Hope this helps.

    Regards,
    Siddharth.

    P.S. If you have any other queries, you may contact me directly at siddharth@persistent.co.in since I donot check this newsgroup very often

Posting Permissions

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