连接Mysql编码问题


连接Mysql数据库的时候

     String url = "jdbc:mysql://localhost:3306/credit?autoReconnect=true&useUnicode=true&characterEncoding=utf8";
          String userName = "root";
            String password="root";

应该注意设置字符的编码;

如果是在XML文件中配置,则是 jdbc:mysql://localhost:3306/credit?autoReconnect=true&useUnicode=true&characterEncoding=utf8; 因为&就是&符号。

今天花了半天时间研究这个,记下来以防忘记。

关于编码问题有几篇文章供参考:

http://bbs.csdn.net/topics/390758162

http://www.cnblogs.com/gyjWEB/p/4600641.html

http://bbs.csdn.net/topics/390372335/

http://blog.sina.com.cn/s/blog_62aab2760100l1hx.html

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM