Home > Java > JavaBase > body text

Solution to Chinese garbled characters in Java database

Release: 2019-12-27 16:31:46
Original
3430 people have browsed it

Solution to Chinese garbled characters in Java database

mysql is a very commonly used data database in our projects. But because we need to save Chinese characters in the database, we often encounter database garbled characters. Let's take a look at how to solve the problem of garbled characters when Java inserts data into the database.

Add useUnicode=true&characterEncoding=UTF-8 parameters after the url configured in the database.

private static String URL = "jdbc:mysql://localhost:3306/ki?useUnicode=true&characterEncoding=UTF-8";
private static String USER = "root";
private static String PASSWORD = "root";
Copy after login

For more java knowledge, please pay attention to the java basic tutorial column.

The above is the detailed content of Solution to Chinese garbled characters in Java database. For more information, please follow other related articles on the PHP Chinese website!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!