i am having a problem with my Wamp Server. When i execute a query which contains Turkish characters, i am getting this error:
SEVERE: Incorrect string value: '\xE7l? ya...' for column 'body' at row 1
java.sql.SQLException: Incorrect string value: '\xE7l? ya...' for column 'body' at row 1
Here is my Java code:
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, user, password);
PreparedStatement p = con.prepareStatement("SET NAMES utf8");
p.executeUpdate();
PreparedStatement ps =
con.prepareStatement("INSERT INTO duyurular values (?, ?, ?, ?)");
ps.setInt(1, 0);
ps.setString(2, title);
ps.setString(3, body);
ps.setInt(4, writer);
ps.executeUpdate();
My database and table which i am trying to write to are all set to "utf8_turkish_ci" collation. My Wamp Server version is 2.2.
I am able to write Turkish characters using PHPMyAdmin sql console but not able to with my Java code. What should i do to get over this? Thanks in advance.