seems like my problem is not necesseraly tied to mysql. at least i can reproduce all of this also with postgres.
instead of writing to the database i tried to read from it (after inserting data via the following simple script on the commandline)
[code]
[EMAIL PROTECTED]:> more example_insert.sql
insert into CTPE_V01_00.CUSTOMER (ID, FAMILY_NAME, GIVEN_NAME)
values ('01', 'K��sel', 'B�b');
insert into CTPE_V01_00.CUSTOMER (ID, FAMILY_NAME, GIVEN_NAME)
values ('02', '�g�l', '�lb�rt');
insert into CTPE_V01_00.CUSTOMER (ID, FAMILY_NAME, GIVEN_NAME)
values ('03', '???????????', '???????????');[EMAIL PROTECTED]:> mysql < example_insert.sql [/code]
here it goes the code for reading: [code]
01 public void list(String _con, String _class,
02 String _user, String _pwd)
03 {
04 Connection con;
05 Statement stmt;
06 try{
07 Class.forName(_class);}
08 catch (java.lang.ClassNotFoundException ex){}
09
10 try{
11 String sql = "select FAMILY_NAME, GIVEN_NAME from " +
12 "CTPE_V01_00.CUSTOMER";
13
14 con = DriverManager.getConnection(_con, _user, _pwd);
15 stmt = con.createStatement();
16 ResultSet rs = stmt.executeQuery(sql);
17 while (rs.next()){
18 String family = rs.getString("FAMILY_NAME");
19 String given = rs.getString("GIVEN_NAME");
20 System.out.println(family + " - " + given);}
21 stmt.close();
22 con.close();}
23 catch (SQLException ex){ex.printStackTrace();}}[/code]
if executing this the result is again garbage.
[result]
[java] .K?sel - B?
[java] ?l - ?b?t
[java] ??????????? - ???????????
[/result]now if i replace line 18 + 19 with the following everything is ok
[code]
18 String family = new String(rs.getBytes("FAMILY_NAME"));
19 String given = new String(rs.getBytes("GIVEN_NAME"));
[/code][result]
[java] .K��sel - B�b
[java] �g�l - �lb�rt
[java] ??????????? - ???????????
[/result]seems like the driver(s) is not able to determin how to transform strings into UTF-8.
any comments?
ciao robertj
smime.p7s
Description: S/MIME Cryptographic Signature
