There are some important parameters in the Mysql jdbc url.

Source: Internet
Author: User

The following article describes several important parameters in the Mysql jdbc url. We all know that there are several important parameters in the MySQL database, this article will also introduce its specific instances. I hope you can get some help through this article.

 
 
  1. MySQL JDBC Driver 

There are two commonly used mysql drivers, one of which is gjtGiant Java Tree. The JDBC Driver name is JAVA class name): org. gjt. mm. mysql. Driver

Or download MysqlJDBC Driver (mm. jar)

The other is the JDBC Driver officially provided by MySQL. Its JAVA class name is com. mysql. jdbc. Driver.

Download MysqlConnector/J.

The URL format of Mysql JDBC is as follows:

Jdbc: mysql: // [host: port], [host: port].../[database] [? Parameter Name 1] [= parameter value 1] [& parameter name 2] [= parameter value 2]...

Only a few important Mysql jdbc url parameters are listed, as shown in the following table:

The connection URL of MySQL can be set:

 
 
  1. jdbc:mysql://localhost:3306/test?user=root&password=
    &useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false  

When using the database connection pool, it is best to set the following two parameters:

 
 
  1. autoReconnect=true&failOverReadOnly=false  

Note that in the xml configuration file, the & symbol in the url must be converted &. For example, when you configure the database connection pool in tomcat server. xml, the Mysql jdbc url sample is as follows:

 
 
  1. jdbc:mysql://localhost:3306/test?user=root&password=
    &useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false  

The above content describes several important parameters of the Mysql jdbc url. I hope it will help you in this regard.

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.