Home  >  Article  >  Java  >  Solution to Chinese garbled characters in Java database

Solution to Chinese garbled characters in Java database

尚
Original
2019-12-27 16:31:463485browse

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";

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!

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