aspose file tools
The moose likes JDBC and the fly likes mysql problem with german special characters Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "mysql problem with german special characters" Watch "mysql problem with german special characters" New topic
Author

mysql problem with german special characters

Markus Kramer2
Greenhorn

Joined: Jan 03, 2002
Posts: 4
hi,
I wrote a software and it worked quite good, but after I installed it on a new machine with j2se 1.4 I've problems with the german special characters.
this code works good on the old machine (jdk 1.3.1) and prints the wanted characters like �,�,�.
--------------------
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
java.sql.Connection conn;
conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx");
Statement s = conn.createStatement();
ResultSet r = s.executeQuery("select something from testtb where id='1'");
r.first();
System.out.println( r.getString(1) );
--------------------
but on the new machine (j2se 1.4) I only receive the character ?.
I updated my org.gjt.mm.mysql to the current MySQL Connector/J 3.0.9 and added
conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx&useUnicode=true&characterEncoding=ISO-8859-1");
but I've got still the same problem.
Thanks in advance
Markus
Markus Kramer2
Greenhorn

Joined: Jan 03, 2002
Posts: 4
I noticed that a simple
System.out.println("���");
prints
???
to the console (SuSE Linux 8.0).
is there a way to change the standard charset of java?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: mysql problem with german special characters
 
Similar Threads
strange problem when accessing MySQL
how to connect MySql
jdbc connection AGGRAVATION!! Can you help?
JDBC to connect to MYSQL
running class from another machine (java+mysql)