• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

German character "ü" can't read from oracle db

 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i stored the character "ü" in oracle db with its equivalent unicode value. but when i tried to access the value using javacodes, it shows different character "¿". How can i solve this problem?
 
Tim Moores
Bartender
Posts: 3137
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What value does the encoding header have? Make sure the HTTP header doesn't inadvertently contradict the equivalent HTML http-equiv header.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you displaying it?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i just tried to access the value using simple jdbc codes
 
Tim Moores
Bartender
Posts: 3137
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesn't really answer any of the questions. Please be a lot more elaborate.
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing you have to do is verify if the German character ü is stored correctly in the database. Because if it's stored incorrectly, it will be impossible to retrieve the correct value. Can you confirm the character is stored correctly in the database?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to add german character 'ü' in oracle db using java, but in db, value updated is '¿'. how can i solve this problem?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nidheesh Krishna wrote:how can i solve this problem?

Can you share the code you have used to insert this German character into the database?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any significance in characterset of database?
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nidheesh Krishna wrote:is there any significance in characterset of database?

Yes! However, the client also has a character set. SQLPlus may show funny characters, and ought to be set, whether in Windows or Linux. SQL Developer should not require the setting.

Before we go any further, please verify what was inserted. Use SQL Developer and query the datum, and post here what you find.
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is the query i tried to insert,


but the value insertd in db is 'Umst¿nde'
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you checked the value with SQL Developer?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by using SQL developer, insert query works correctly. But, through java codes, problems again arises
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nidheesh Krishna wrote:by using SQL developer, insert query works correctly. But, through java codes, problems again arises

I want to be clear, because this is very important. Are you saying that when INSERTing and SELECTing via SQL Developer, you see the correct character? If so, the database character set supports the character and needs no changing.

Please answer that, and then 2 more questions:

1) If you INSERT via SQL Developer, but SELECT in java, what character is shown?
2) If you INSERT via java , but SELECT in SQL Developer, what character is shown?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when INSERTing and SELECTing via SQL Developer, i got the correct character

1) ü
2) ¿


 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nidheesh Krishna wrote:when INSERTing and SELECTing via SQL Developer, i got the correct character

1) ü
2) ¿


Okay, so it's Java. Now let's do one more test, but i hope someone else can help, because this is not my expertise.

1) How are you displaying the results? A web page?
2) If you log the results, showing them either in a debug window or in a file, which character shows?
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) i used a simple java console program
2) ¿
 
Tim Moores
Bartender
Posts: 3137
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that many console and command line environments can't properly display non-ASCII characters. Write them to a file or web page for better introspection.

(On an unrelated note, I don't think "Umstünde" is a word in German. "Umstände" is, as would be "umstünde", although the latter would be old-fashioned.)
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nidheesh Krishna wrote:1) i used a simple java console program
2) ¿

Thank you. I do not know the answer. Hopefully one of the java experts here can answer.

Note please, this is not an Oracle issue. This is simply an issue with the program displaying foreign characters. That much we have established, and simplifies the question.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When it comes to characters and character set issues you have two places the issue could occur.
It could be the character set you have read from (eg a file or database), it could be the character set you have written to (a database or command line or file).

in this case you have to double that, as you have written to a db and are then reading from it and displaying it.

So, when you INSERT that word into the DB via Java and then look at it in the DB using SQL Developer does it look correct?
Then you need to check whether it is read out correctly, which would require writing it to some reliable output, and a File in the correct character set would be the best bet...but be sure to open it in a viewer that can handle that character set.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave, please look a couple posts up. I believe the database has been ruled out.
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All they said was:
'
when INSERTing and SELECTing via SQL Developer, i got the correct character
'

No mention of INSERTing via Java and checking via SQL Developer.
I saw you ask, but I didn't see an answer.
 
Brian Tkatch
Bartender
Posts: 567
25
Linux Notepad Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave, sorry, it's a little further up.

I asked:
1) If you INSERT via SQL Developer, but SELECT in java, what character is shown?
2) If you INSERT via java , but SELECT in SQL Developer, what character is shown?
To which the response was:
1) ü
2) ¿

 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shows how easy it is to misinterpret a post!

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe this section about JDBC Programming with Unicode might be useful.
 
Nidheesh Krishna
Ranch Hand
Posts: 52
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when i tried to insert values using netbeans IDE, the german character inserted and displayed correctly. BUt, problem arises when i am using a java console program
 
Tim Moores
Bartender
Posts: 3137
50
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:Note that many console and command line environments can't properly display non-ASCII characters. Write them to a file or web page for better introspection.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic