Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2009
    Posts
    14

    Unanswered: Error fetching Registered Trademark symbol from DB2 9.7

    I have DB2 9.7 in which one of varchar column stores registered trademark symbol - .
    When my J2EE application tries to read it using JDBC, the symbol fetched is inconsistent.
    Most of the times it comes , but sometime it comes as question mark - ?

    Could you please let me know what is correct way to fetch this?

    So far tried below,
    resultset.getString(columnname)
    resultset.getBytes(columnname, "UTF-8")

    Thanks,
    Gokul

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Have you checked whether the correct bytes were stored in the DB2 table? You can use the HEX() function for that. If this is working fine, you'll have to make sure that your client is using the correct code page as well so that the code point (which is just a number) returned by DB2 maps to the (R) symbol in the client's code page.

    If things sometimes work, sometimes not, I suspect that the code pages setting in your application is not consistent. If the application is Java, you should always have UTF8, but then you have to make sure you also insert the data as UTF-8 and that your front end (shell or browser or whatever) doesn't mangle the character representation. In order to verify this, I would look at the numerical value, i.e. the code point, in all stages of the chain.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Oct 2004
    Location
    DELHI INDIA
    Posts
    338
    its most probably the application which is inserting data into the table as few records with "?". For finding the root cause, you can export that particular field into a flat file and scan for any records with "?" and not with the registerd trademark symbol. If such data exists, then you need to fix the application code which is inserting the records.

    Good Luck !

    Jayanta Datta
    DB2 UDB DBA
    IBM India, Global Delivery
    New Delhi

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    The question mark that you see is most likely the "substitution character", which a component in the data flow chain uses when it cannot represent a certain character.
    This can happen e.g. when DB2 stores the as UTF-8 (check this, i.e., verify which code page DB2 is using for your data column), and the application (or maybe one of the intermedate "application layers" like e.g. DB2 Connect) uses a codepage that does not have the character.
    But it could also happen when the (intermediate) application *thinks* it does not have the input character in its codepage, since it *thinks* DB2 is using a different codepage then the one it does use.
    Or (more likely) when it tries to convert the DB2 character from the (correct) DB2 codepage to the (erroneously assumed) codepage of the application without (while the correct codepage of the application actually has the character).
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

  5. #5
    Join Date
    Dec 2009
    Posts
    14
    Thanks for your valuable inputs. Let me check these points and get back.

  6. #6
    Join Date
    Dec 2009
    Posts
    14
    Sorry, was struck in another issues. So was not able to look into this.

    I got the code page for the DB as below but was not sure how to get it for my application. It is a J2EE application running WAS 6.1 server. There is no UI and MDB drives the application. Please advise.

    Database code page = 1208
    Database code set = UTF-8

  7. #7
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by cse_gokul View Post
    I have DB2 9.7 in which one of varchar column stores registered trademark symbol - .
    How do you verify that?

    Quote Originally Posted by cse_gokul View Post
    Most of the times it comes , but sometime it comes as question mark - ?
    How do you know that?

  8. #8
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    Quote Originally Posted by cse_gokul View Post
    I got the code page for the DB as below but was not sure how to get it for my application. It is a J2EE application running WAS 6.1 server. There is no UI and MDB drives the application. Please advise.

    Database code page = 1208
    Database code set = UTF-8
    Code page 1208 is indeed UTF-8, which should be fine in all respects. Could be an erroneous setting in the J2EE app. or maybe in the DB settings of WAS.
    Which all seem unlikely to me.

    Try to find out which other characters have the same problem (like accented letters: , or the euro sign: ) and in which circumstances the problem shows up and when it doesn't. (e.g.: on the way into the database: in that case, from which data source; on the way out: which component is responsible for diplaying the character(s); ...)
    --_Peter Vanroose,
    __IBM Certified Database Administrator, DB2 9 for z/OS
    __IBM Certified Application Developer
    __ABIS Training and Consulting
    __http://www.abis.be/

Posting Permissions

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