Java连接mySQl

 

要防止乱码发生,一方面在安装mySQL时要正确制定编码的类型

 

如果发生乱码可以尝试在连接字符串中编码设置信息:

 

"jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8";

 

另外还可以尝试在建立连接之后立即设置编码类型:

 

执行SQL语句 "set names utf8"

 

   

 

参考:

http://student.csdn.net/space.php?uid=14032&do=blog&id=36249

相关文章:

  • 2022-12-23
  • 2021-11-03
  • 2022-12-23
  • 2021-10-09
  • 2021-09-14
  • 2021-08-14
  • 2021-07-17
  • 2021-09-19
猜你喜欢
  • 2021-06-02
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2021-11-26
  • 2021-05-01
  • 2022-12-23
相关资源
相似解决方案