Here you can find the source of createConnectionUtf8(String connString)
public static final Connection createConnectionUtf8(String connString) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
//package com.java2s; //License from project: Open Source License import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class Main { public static final Connection createConnectionUtf8(String connString) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { if (connString == null || connString.length() == 0) { throw new IllegalArgumentException("connString"); }//from ww w. j av a2 s .c om Class.forName("com.mysql.jdbc.Driver").newInstance(); Properties props = new Properties(); props.put("useUnicode", "true"); props.put("characterEncoding", "utf8"); props.put("characterSetResults", "utf8"); Connection conn = DriverManager.getConnection(connString, props); Statement st = conn.createStatement(); st.execute("SET NAMES 'utf8'"); st.execute("SET character_set_client=utf8"); st.execute("SET character_set_connection=utf8"); st.execute("SET character_set_results=utf8"); st.close(); return conn; } }