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

java导入mysql出现中文乱码

WBOY
Release: 2016-06-06 09:32:49
Original
1351 people have browsed it

mysqljava乱码

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

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

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

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

为什么。。。。。。

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template