mysql 中文乱码问题。。。大家看看网上我查过了 但还是有问题!

Azrael99999 Azrael99999 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我吧 MSYQL 全部设置为 utf-8
数据库 和 表格 也设置为 utf-8
myeclipse Resourse 也是 utf-8
public void getConnect() {
Connection conn = null;
Statement st = null;
try {
Class.forName("org.gjt.mm.mysql.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
try {
conn = DriverManager
.getConnection(
"jdbc:mysql://localhost:3306/DBWorkCheck?useUnicode=true&characterEncoding=UTF-8",
"root", "1234");
st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from tbuser");
while (rs.next()) {
String s = rs.getString(3);
System.out.println(s);
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (st != null)
st.close();
if (conn != null)
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}

}
我用 DEBUG 看过 是乱码
控制台输出也是乱码
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
Azrael99999
Java SE 62,620 成员 307,251 内容