Bug #18405 ISO-8859-1
Submitted: 21 Mar 2006 20:22 Modified: 29 Mar 2006 20:41
Reporter: Andreas Döll Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:mysql-connector-java-5.0.0-beta OS:Windows (WinXP)
Assigned to: CPU Architecture:Any

[21 Mar 2006 20:22] Andreas Döll
Description:
When I use any of the insert, update or select statement within my Application every Sign is inserted correctly into the MySQL Database ... any except the "€".
Wiht no other special Sign like "Ä" or "ß" oder "^"  the problem occures.

How to repeat:
Insert or Update again ;)
[27 Mar 2006 13:04] Tonci Grgin
Thanks for your bug report. Can you please be more specific and provide dump of tables along with structure and offending insert commands?
[27 Mar 2006 13:55] Andreas Döll
package bug;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class BugClass {
	
	Connection connection=null;
	String databaseURL="jdbc:mysql://192.168.1.2:3306/";
	String databaseName="ef";
	
	
	public BugClass() {
		super();
	}
	
	
	
	public void doTheBug(String usr, String pwd) throws Throwable{
		Class.forName("org.gjt.mm.mysql.Driver");
		this.connection=DriverManager.getConnection(this.databaseURL+this.databaseName,usr,pwd);
		Statement statement=this.connection.createStatement();
		statement.execute("insert into abrechnung (fk_Filiale, bezeichung) values (1,'€')");
		ResultSet resultSet=statement.executeQuery("select fk_Filiale, bezeichung from abrechnung where fk_Filiale=1");
		while(resultSet.next()) {
			System.err.println("FK Filiale: "+resultSet.getString(1)+" bezeichnung: "+resultSet.getString(2)+"\n");
		}
		/*
		 * OUTPUT START
		 * FK Filiale: 1 bezeichnung: ?
		 * OUTPUT END
		 * 
		 * the "?" is unexpected 
                  * The database charset is latin 1
		 */
	}
	
	
	public static void main(String[] args) {
		String usr=args[0];
		String pwd=args[1];
		BugClass bugClass=new BugClass();
		try {
			bugClass.doTheBug(usr,pwd);
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
[27 Mar 2006 13:58] Andreas Döll
Source

Attachment: BugClass.java (application/octet-stream, text), 1.30 KiB.

[27 Mar 2006 19:18] Tonci Grgin
Thanks for additional info. Can you please send table structure and datadump too?
[27 Mar 2006 19:44] Andreas Döll
SQL create Sktipt

Attachment: New Project 20060327 2143.sql (application/octet-stream, text), 1.59 KiB.

[27 Mar 2006 20:08] Andreas Döll
it's that simple:
execute the create skript, start eclipse and use usrname & userpwd as main() arguments and you will see the output. (The Incorrect "€" char).
[27 Mar 2006 20:37] Mark Matthews
Could you try a nightly build of 5.0 from http://downloads.mysql.com/snapshots.php#connector-j

We put a fix in a few weeks back that maps latin1 -> Cp1252 which should do the trick for your issue.
[27 Mar 2006 20:43] Andreas Döll
thanks for dealing so quickly with my problem :)

... and im sorry about my bad english 

best regards :)
[29 Mar 2006 15:35] Mark Matthews
I'm assuming that means we've fixed the issue? If so, can we close this bug?
[29 Mar 2006 20:33] Andreas Döll
the issue is fixed - professional and fast job, the bug can be closed 

thanks for your support
[29 Mar 2006 20:41] Mark Matthews
Fix is in source tree, will be released as part of 3.1.13 and 5.0.1.