aspose file tools*
The moose likes JDBC and the fly likes MySQL and foreign languages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL and foreign languages" Watch "MySQL and foreign languages" New topic
Author

MySQL and foreign languages

Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

Hello,

i have an application that uses jsp with mysql as database server.
are there any settings that it has so it can show Greek language??

everything works ok but when i use a table to fill a select it doesnt show the data in the table...

thnx in advance.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

You do need to configure MySQL to use UTF-8 for your tables. Its default is Latin-1 which is not suitable for Greek. And you do need to make your JSPs use UTF-8 as the response encoding as well. And when you are trying to find out why you don't see Greek characters correctly, don't try testing both MySQL and JSP at the same time. Test them separately.
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

thnx for your reply,

do i have to set utf-8 for each table or just set mysql for each database i have created???i set it uo from mysql administrator?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

I don't know. I would look it up in the MySQL documentation for you, but it's on my home computer and I'm at work. There's a whole section about encodings and collations. You will find it in the MySQL "docs" directory (I think) on your computer.
stu derby
Ranch Hand

Joined: Dec 15, 2005
Posts: 333
Originally posted by Paul Clapham:
I don't know. I would look it up in the MySQL documentation for you, but it's on my home computer and I'm at work. There's a whole section about encodings and collations. You will find it in the MySQL "docs" directory (I think) on your computer.

The MySQL documentation is also online at:
http://dev.mysql.com/doc/refman/5.0/en/charset.html
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

Of course I should have known the documentation would be on line.
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

Originally posted by Aris Doxakis:
thnx for your reply,

do i have to set utf-8 for each table or just set mysql for each database i have created???i set it uo from mysql administrator?


AFAIR
If you build database using utf 8 then all tables will be utf 8
because you database default encoding is utf-8
along with this you will need to add some extra parameter to your connection string , it could be like :


hth


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

i found the language files but i cant find out how to setup the language???
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

the tables that i have on my dayabase are mostly with greek written data.
sow when i use them in my jsp pages they are showed as $%#%^$@#$.
do i have to setup my database as greek or my tables individualy???
and how because i cant find anything on the manuals

i use mysql 4.1 ....
thxs\

\
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

Okay. Now is that happening because the data in the database is corrupt, or because it is being corrupted when your JSP sends it to the browser? I suggested already to not test both of those things at the same time. So just write a Java application that reads from the database and displays data in a Swing GUI. If that shows correct data then you are doing the JSP wrong. If it shows incorrect data then the database is probably set up wrong.

Let us know what your tests show.
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

when i use the data from tables that there data is in english there is no problem in presenting them.but when i access tha data that are in greek theres my problem.

i dont think there is anything corrupt in my database either that there is something wrong with the jsp page because i am using a result set very simple made.


thnx
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18902
    
    8

i dont think there is anything corrupt in my database either
That doesn't sound like you did any testing at all. You still don't know that when you read something from your database, you get the correct data. The test you should do for the database is very simple: write a query that will return one column of one row, whose value you know. Then the test is this:
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

i made the test.the data isnt returned correct when i use the tables that are written in greek..when i take the data from tables with english data they are returned correctly..

if that is what you are asking of me..
hope i understood your question right.
Aris Doxakis
Ranch Hand

Joined: Dec 05, 2004
Posts: 136

one more thing..
is it because i use winXP en???
 
 
subject: MySQL and foreign languages