4
$\begingroup$

I'm having trouble transferring Unicode strings from one MySQL database to another using DatabaseLink` functions. Here is my failed attempt to read a string from one database and insert it into another:

SQLSelect[conn["source"], "users", {"user_name"}, SQLColumn["user_id"] == 56]
(* {{"Дмитрий"}} *)

SQLUpdate[conn["target"], "users", {"user_name"}, {%[[1, 1]]}, SQLColumn["user_id"] == 56];

SQLSelect[conn["target"], "users", {"user_name"}, SQLColumn["user_id"] == 56]
(* {{"???????"}} *)

Any ideas on how to do this correctly? Thanks!

$\endgroup$
1
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$
    – Michael E2
    May 16, 2016 at 16:58

1 Answer 1

2
$\begingroup$

Based on this answer, I solved the issue by adding "Properties" -> {"characterEncoding" -> "UTF-8"} to the connection:

conn = OpenSQLConnection[JDBC["mysql", "localhost:3306/test"], 
  "Username" -> user, "Password" -> pwd, 
  "Properties" -> {"characterEncoding" -> "UTF-8"}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.