As stated in the title, I have a problem between java and mysql
mysql DB , Tables, and columns are utf8_unicode_ci I have an application that takes some input from an XML, then type the query ...
public string [] saveField (string xmltag, string lang) {NodeList nodo = this.doc.getElementsByTagName (xmltag); String [] pos = new string [nodo.getLength ()]; For (int i = 0; i & lt; nodo.getLength (); i ++) {node child = node. Item (i); Pos (i) = "INSERT TABLE (ID, LANGUAGE, VALUES) VALUES (" + child.getAttributes (.) GetNamedItem ("id"). GetNodeValue (.) ToString () + "," + lang + "," + "'" + Child.getFirstChild () GetTextContent () + "'" + ");"; } Return status; } This method has an array of strings that includes one or more SQL included questions ... then
class .for name ("com. Mysql jdbc.Driver ") newInstance () .; Con = DriverManager.getConnection ("jdbc: mysql: /// dbname", "user", "pass"); ..... statement; S = this.con.createStatement (); S.execute (query); With both the special characters are stored as s.execyte and s.executeUpdate ?
Four special characters are not stored correctly: Mesurat Type to ????????? is stored as
Hi! Hi!
Any advice is stored as?
Thanks
solved, I forgot to add encoding while starting connection Gone:
was the first:
con = DriverManager.getConnection ("jdbc: mysql: /// dbname", "user", "pass"); UTF-8 "," user "," pass ");
Comments
Post a Comment