hi!
I did another try and if I put the letter N in front of the string literal the comparision test succeeds.
// Empty table
Statement statement1 = connection.createStatement();
statement1.execute("delete jahia_db_test");
// Insert string
Statement statement2 = connection.createStatement();
String testField = "Latin : ���� / Cyrillic : \u0419\u0416 / Chineeze : \u8bed\u8a00";
statement2.execute("insert into jahia_db_test (testfield) values (N'" + testField + "')");
Statement statement1 = connection.createStatement();
statement1.execute("delete jahia_db_test");
// Insert string
Statement statement2 = connection.createStatement();
String testField = "Latin : ���� / Cyrillic : \u0419\u0416 / Chineeze : \u8bed\u8a00";
statement2.execute("insert into jahia_db_test (testfield) values (N'" + testField + "')");
// Fetch and compare
Statement statement3 = connection.createStatement();
ResultSet rs = statement3.executeQuery("select * from jahia_db_test");
Statement statement3 = connection.createStatement();
ResultSet rs = statement3.executeQuery("select * from jahia_db_test");
while (rs.next())
{
String test = rs.getString(1);
if (test.equals(testField))
{
System.out.println("OK"); <----- Result
}
else
{
System.out.println("FAIL");
}
}
{
String test = rs.getString(1);
if (test.equals(testField))
{
System.out.println("OK"); <----- Result
}
else
{
System.out.println("FAIL");
}
}
So all we have to do is wait for a jahia release which prefixes all string literals with the N letter when updating or inserting strings into the database :->
Regards
/Lars Hagrot
