title: Problems reading/writing UTF-8 data in MySQL from Java using JDBC connector 5.1
body: <p>I have a scenario with two MySQL databases (in UTF-8), a Java code (a Timer Service) that synchronize both databases (reading form first of them and writing/updating to second) and a Web application that lets modify data loaded in the second database. </p>
  
  <p>All database access is made using IBATIS (but I detect that I have the same problem using JDBC, <code>PreparedStatement</code>s and <code>ResultSet</code>s) </p>
  
  <p>When my java code reads data from first database, I obtain characters like <code>'Ã³'</code> when really it must be <code>'ó'</code>. This data is wroten without modifications to the second database. </p>
  
  <p>Later, when I see the loaded data in my web application, I see the extrange character despite the <code>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;</code>. </p>
  
  <p>If I decode the data using ... </p>
  
  <pre><code>new String(data.getBytes("UTF-8"));
  </code></pre>
  
  <p>... I visualize correctly the character (ó). But I can not use this solution as a general rule because when I modify data using web application form, the data is not updated in UTF-8 in my second database (despite the database is UTF-8 and my connection string is using characterEncoding, characterSetResults and useUnicode parameters). </p>
  
  <p>From my Java code I obtain the following Database settings: </p>
  
  <pre><code>character_set_client--&gt;utf8 
  character_set_connection--&gt;utf8 
  character_set_database--&gt;utf8 
  character_set_filesystem--&gt;binary 
  character_set_results--&gt;utf8 
  character_set_server--&gt;latin1 
  character_set_system--&gt;utf8 
  character_sets_dir--&gt;/usr/local/mysql51/share/mysql/charsets/ 
  </code></pre>
  
  <p>the character_set_server setting can't be changed and I don't know what I am doing wrong!! </p>
  
  <p>How can I read UTF-8 data from MySQL using JDBC connector (<code>mysql-connector-java-5.1.5-bin.jar</code>)? </p>
  
  <p>Is the problem with reading data from the first database or writing to the second database?</p>