If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error fetching Registered Trademark symbol from DB2 9.7

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-28-11, 21:01
cse_gokul cse_gokul is offline
Registered User
 
Join Date: Dec 2009
Posts: 14
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
Reply With Quote
  #2 (permalink)  
Old 07-30-11, 13:32
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 07-30-11, 15:35
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
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
Reply With Quote
  #4 (permalink)  
Old 07-31-11, 12:57
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
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/
Reply With Quote
  #5 (permalink)  
Old 08-02-11, 05:05
cse_gokul cse_gokul is offline
Registered User
 
Join Date: Dec 2009
Posts: 14
Thanks for your valuable inputs. Let me check these points and get back.
Reply With Quote
  #6 (permalink)  
Old 08-22-11, 19:16
cse_gokul cse_gokul is offline
Registered User
 
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
Reply With Quote
  #7 (permalink)  
Old 08-22-11, 22:50
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
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?
Reply With Quote
  #8 (permalink)  
Old 08-23-11, 02:38
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
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/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On