tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anastasios Angelidis <>
Subject Re: jdbc, mysql and character encoding
Date Thu, 02 Jan 2003 20:18:53 GMT
Well I know for a fact that if you are using windows, the console window 
canot display extended characters. Only the standard ASCII chars...

It doesnt really matter, as long as you get the desired result in your 

All characters in the end are bytes, a byte is a byte it all depends how 
each application interprets the bytes and displays them. So if the the 
console application uses the standard printf functions etc... you will 
see the weird characters ;) wrote:

>I've my jsp, where I simply want to fill a table with some "italian" characters:
>Connection conn = DriverManager.getConnection ("jdbc:mysql://localhost:3306/jdbctest?useUnicode=true&characterEncoding=ISO-8859-1",
"usrjdbc", "pwd");
>Statement stmt = conn.createStatement();
>stmt.executeUpdate("INSERT INTO table (text) VALUES ('àèìùò')");
>ResultSet rs = stmt.executeQuery("SELECT * FROM table");
>while ( {
>   int id = rs.getInt("id");
>   String text = rs.getString("text");
>   out.print("row#" + rs.getRow() + ": id=" + id + ", text=" + text);
>   out.println("<br>");
>Everything works fine, and when I print the content of the db with the getString mehotd,
I see my characters.
>The problem is that when I go to the MySQL prompt, I can see strange characters isntead
of the ones I tried to write.
>MySQL uses the default ISO-8859-1 encoding, and since I'm telling to the JDBC driver to
use ISO-8859-1, I can't explain what's wrong
>To unsubscribe, e-mail:   <>
>For additional commands, e-mail: <>

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message