The jdbc encoding is set when java connects to the database.

Source: Internet
Author: User

The jdbc encoding is set when java connects to the database.

I found that there are a lot of pitfalls on the Internet, and many meanings are incomplete. For example, when jdbc is connected to the mysql database, set the character set encoding.


You can configure mysql as follows. You can add character set settings directly after the url:


... Omitted

String url = "jdbc: mysql: // localhost: 3306/exceltest1? UseUnicode = true & characterEncoding = UTF-8 & zeroDateTimeBehavior = convertToNull ";
String username = "root ";
String password = "123456 ";

... Omitted


But oracle cannot connect, and he will prompt that SID cannot be found.

The error example is as follows:

Url = jdbc: oracle: thin: @ 192.168.1.233: 1521: oradbcharacterEncoding = UTF-8

In fact, the oracle Character Set defaults to the database character set. The method for viewing the database character set is as follows:

Select userenv ('language') from dual;

The following describes how to modify the character set of an oracle database (searched online ):

How to modify the character set of an oracle Database

I chose to back up the database, delete the original database, create a database, set the character set, and then import it to the backup ~

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.