Re: Character set/Collation problem in MySQL 4.1
Posted by: Adam Beguelin
Date: April 02, 2005 01:18PM

I have a similar problem. I'm trying to insert a java string value into a table but the special characters (\u2019 and \u2018 quotes in this case) get converted to questionmarks.

I'm using 4.1.7-standard on linux (fedora core2). If I run the same program against 4.1.8-nt running on windows XP. (I am using the latest version of the jdbc driver as well.)

Suggestions?


String s = new String("\u2019hello\u2018");
PreparedStatement ps = m_conn.prepareStatement("INSERT INTO myRecords(TITLE) VALUES( ? )");
ps.setString(1,s);
ps.executeUpdate();
ps = m_conn.prepareStatement("select title from myRecords where title like ?");
ps.setString(1,s);
rs = ps.executeQuery();
if (rs.next()) {
String title = rs.getString(1);
if (title.equalsIgnoreCase(s))
System.out.println("insert worked");
else
System.out.println("insert failed: title is " + title);
} else {
System.out.println("no result set");
}

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: Character set/Collation problem in MySQL 4.1
2891
April 02, 2005 01:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.