Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Euro sign not displayed properly when fetched from DB
"Raga" <raaga.t_at_gmail.com> wrote in message news:1160290986.898568.79630_at_b28g2000cwb.googlegroups.com... Hi,
I stored the euro sign (? ) (press alt+0 1 2 8 on Windows to get that sign) in an Oracle database table in varchar2 type column. when I do 'select * from table_euro;', I get the euro sign displayed properly in SQL prompt.
SQL> select * from table_euro
2 /
NAME
Now, I programatically read it using Java Resultset object, but it displays as Ç (which is Alt + 1 2 8 in key press). This' how I fetch it programmatically:
dbStatement = dbCon.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
dbDataReader = dbStatement.executeQuery(query);
....
while(until result set is read fully)
{
Object fieldData = dbDataReader.getObject(fieldIndex);
System.out.println(fieldData);
}
For the euro sign, the above prints Ç . Why is that? Can anyone please throw some light on it?
Thanks.
I can address this in a general way. The whole issue is complex.
For the whole scheme to work you need several things set up properly.
The database must have been built with a character set that allows for the character you are storing. (eg UTF8 etc.)
The client must be capable of displaying the character. The client must have the nls_language set correctly. (must be a character set that the displayed character contains)
Now there is an optimization in Oracle that can cause some problems. If the database character set is the same as the client character set then Oracle does not check the incoming data. So someone can input the wrong character and when it is sent to a machine where the nls_language is different it can translate it incorrectly. (because it was put in incorrectly)
As others have said you have to do a dump on the data and see what is actually being stored. Then look up in the database character set what that is. That will probably explain what is going on. Jim Received on Sun Oct 08 2006 - 10:19:50 CDT
![]() |
![]() |