开始学习mysql数据库事遇到了这样的问题,eclipse中向mysql数据库中写入中文时出现了乱码问题,
解决办法是:
连接数据库时,及DriverManager.getConnection(URL),中的URL可以这样写。。。。。。。。
如:
A、 Connection con = DriverManager.getConnection("jdbc:mysql://localhost/student?
useUnicode=true&characterEncoding=gbk", "root", "");
B、con=DriverManager.getConnection("jdbc:mysql://localhost:3306/itat_msg?user=itat&password=itat123&useUnicode=true&characterEncoding=UTF-8");