Home >Database >Mysql Tutorial >java导入mysql出现中文乱码

java导入mysql出现中文乱码

WBOY
WBOYOriginal
2016-06-06 09:32:491352browse

mysqljava乱码

我写了一个小程序把txt中的文字读取并写入mysql,然而无论怎么样都有乱码,我试了很多方法都不行,结果最后解决居然是因为url的问题,崩溃了,求大神们看看
之前是这样

<code> public static final String url = "jdbc:mysql://127.0.0.1/website?useUnicode=true&characterEncoding=UTF-8";</code>

改成这样竟然就没问题了。。。

<code>  public static final String url = "jdbc:mysql://localhost/website?characterEncoding=utf8";</code>

为什么。。。。。。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn