title: Inserting Korean characters via JDBC through MYSQL stored procedure giving error
body: <p>I believe I am using the correct queryString params for jdbc connection</p>
  
  <pre><code>jdbc:mysql://localhost:3306/databasename?useUnicode=true&amp;characterEncoding=utf8&amp;noAccessToProcedureBodies=true
  </code></pre>
  
  <p>My database is <a href="http://dev.mysql.com/doc/refman/5.1/en/faqs-cjk.html#qandaitem-B-11-1-2" rel="nofollow">correctly set-up</a> to support utf-8 (default character variables). </p>
  
  <pre><code>character_set_client utf8
  character_set_connection utf8
  character_set_database latin1
  character_set_filesystem binary
  character_set_results utf8
  character_set_server latin1
  character_set_system utf8
  </code></pre>
  
  <p>My sproc defines each parameter as utf8 where necessary </p>
  
  <pre><code>IN _shortDesc MEDIUMTEXT character set utf8,
  </code></pre>
  
  <p>CALLing the sproc through MySQLWorkbench works as expected. 
  However, calling it from Java results in an exception</p>
  
  <pre><code>java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05t\x00...' for column '_shortDesc'
  </code></pre>
  
  <p>Interestingly, changing sproc definition for relevant fields to <code>utf16</code> or <code>ucs2</code> results in no exception but incorrect Korean characters in the table. </p>
  
  <p>I have also tried using a byte array when building the sql parameters in Java</p>
  
  <pre><code>getBytes(Charset.forName("UTF-8"))
  </code></pre>
  
  <p>But the exception is still thrown. </p>
  
  <p>What is the correct way to set this up to correctly pass CJK characters through Java to MySQL via a stored procedure?</p>
  
  <p><em><strong>EDIT</em></strong>
  I am using SimpleJdbcCall from the spring framework</p>
  
  <pre><code>DriverManagerDataSource ds = new DriverManagerDataSource();
  ds.setDriverClassName("com.mysql.jdbc.Driver");
  ds.setUrl("jdbc:mysql://server/test?characterEncoding=utf8");
  ds.setUsername("user");  
  ds.setPassword("pass");
  
  // must explicitly declare params
  SimpleJdbcCall jdbc = new SimpleJdbcCall(ds)
      .withProcedureName("sp_gms_addGameTranslationsTest");
  
  SqlParameterSource in = new MapSqlParameterSource()
      .addValue("_test", "그러나 사디라");
  
  jdbc.execute(in);
  </code></pre>