java怎么連接sql server數據庫,mysql 連接編碼_連接Mysql編碼問題

 2023-10-21 阅读 25 评论 0

摘要:連接Mysql數據庫的時候String url = "jdbc:mysql://localhost:3306/credit?autoReconnect=true&useUnicode=true&characterEncoding=utf8";String userName = "root";String password="root";應該注意設置字符的編碼

連接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

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/156487.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息