Using a prepared expression, I try to save Russian characters in a field in certain tables. The table and field use the utf8 character set and utf8_bin sort.
If I manually start the insertion through the IDE or on the command line, the line saves as expected.
INSERT INTO utf8Table VALUES(' ');
Then I can query this table and also return the expected row.
The connection is established through the resource in the tomcat context.xml file with the following configuration:
<Resource
name="jdbc/DoolliDB"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
useUnicode="true"
characterEncoding="UTF8"
....
</Resource>
As I said, I can read strings / characters well, so I assume that both the table and the connection settings are set correctly.
I use PreparedStatement / CallableStatement as follows:
CallableStatement callableStmt = __mySqlConnector.getConnection().prepareCall("INSERT INTO utf8Table VALUES(?)");
callableStmt.setString(1, " ");
callableStmt.executeUpdate();
, :?????????????????
, "" utf-8, ΓΌber, .
System.getProperty("file.encoding")
java.nio.charset.Charset.defaultCharset().name()
UTF-8.
.