title: Can't store UTF-8 Content in MySQL Using Java PreparedStatement
body: <p>For some strange reason I can't seem to add UTF-8 data to my MySQL database.  When I enter a non-latin character, it's stored as ?????.  Everything else is stored fine.  So for example, "this is an example®™" is stored fine, but "和英辞典" is stored as "????".</p>
  
  <p>The connection url is fine:</p>
  
  <pre><code>private DataSource getDB() throws PropertyVetoException {
      ComboPooledDataSource db = new ComboPooledDataSource();
      db.setDriverClass("com.mysql.jdbc.Driver");
      db.setJdbcUrl("jdbc:mysql://domain.com:3306/db?useUnicode=true&amp;characterEncoding=UTF-8");
      db.setUser("...");
      db.setPassword("...");
      return db;
  }
  </code></pre>
  
  <p>I'm using PreparedStatement as you would expect, I even tried entering "set names utf8" as someone suggested.</p>
  
  <pre><code>    Connection conn = null;
      PreparedStatement stmt = null;
      ResultSet rs = null;
      try {
          conn = db.getConnection();
  
          stmt = conn.prepareStatement("set names utf8");
          stmt.execute();
          stmt = conn.prepareStatement("set character set utf8");
          stmt.execute();
  
                      ... set title...
          stmt = conn.prepareStatement("INSERT INTO Table (title) VALUES (?)");
          stmt.setString(1,title);
  
          stmt.execute();
      } catch (final SQLException e) {
      ...
  </code></pre>
  
  <p>The table itself seems to be fine.  </p>
  
  <pre><code>Default Character Set: utf8
  Default Collation: utf8_general_ci
  ...
  Field title:
  Type text
  Character Set: utf8
  Collation: utf8_unicode_ci
  </code></pre>
  
  <p>I tested it by entering in Unicode ("和英辞典" specifically) through a GUI editor and then selecting from the table -- and it was returned just fine.  So this seems to be an issue with JDBC.</p>
  
  <p>What am I missing?</p>