Properties properties= new Properties();
properties.setProperty("user", login);
properties.setProperty("password", password);
properties.setProperty("useUnicode","true");
properties.setProperty("characterEncoding","UTF-8");
conn = DriverManager.getConnection("jdbc:mysql://" + host + "/" + db, properties);
String message = "Раунд " + nextRoomId;
Data.db.executeUpdate("INSERT INTO chat(message) VALUES('" + message + "')");
I get this:
Раунд 338
mysql config:
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
the tables and database are fully utf-8 encoded, I can't insert a cyrillic string from java, because I get bad encoded string in my table
what I'am doing wrong?