作者:tim-wu
| Version: | Server-6.0 |
|---|---|
| Status: | In-Documentation |
| Priority: | Low |
| Description: | Pushed to 6.0.4 on Nov 27/2007.
|
String url = "jdbc:mysql://localhost:3306/u?useUnicode=true&characterEncoding=utf8&useBlobToStoreUTF8OutsideBMP=true&utf8OutsideBmpIncludedColumnNamePattern=a";



connection = DriverManager.getConnection(url, username, password);
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select * from t where a like '你%'");
while (rs.next())
{
// String name = new String(rs.getBytes("a"), "UTF-8");
String name = rs.getString("a");
System.out.println(name);
}
stmt.close();
connection.close来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/11310314/viewspace-179/ ,如需转载,请注明出处,否则将追究法律责任。