MySQL JDBC URL format

Source: Internet
Author: User

The MySQL JDBC URL format is as follows:

jdbc:mysql://[host:port],[host:port].../[database][. Parameter name 1][= argument value 1][& parameter name 2][= argument value 2] ... Only a few important parameters are listed, as shown in the following table: parameter namesparameter Description default minimum version requirement Userdatabase user name (for database connection) all versions PasswordUser password (for connection to database) all versions Useunicodewhether to use the Unicode character set, if the parameter characterencoding is set to gb2312 or GBK, the value of this parameter must be set to True false 1.1g CharacterencodingWhen Useunicode is set to True, the character encoding is specified. For example, can be set to gb2312 or GBK false 1.1g AutoReConnectis the connection automatically reconnected when the database connection is interrupted abnormally? false 1.1 Autoreconnectforpoolswhether to use the reconnection policy against the database connection pool false 3.1.3 Failoverreadonlyis the connection set to read-only after the automatic reconnection is successful? true 3.0.12 Maxreconnectswhen AutoReConnect is set to true, the number of retry connections is 3 1.1 Initialtimeoutwhen AutoReConnect is set to true, the time interval between two re-interconnects, in seconds: 2 1.1 ConnectTimeoutTime- out, in milliseconds, when establishing a socket connection with the database server. 0 means never timeout, for JDK 1.4 and later 0 3.0.1 Sockettimeoutsocket operation (read-write) timeout, in milliseconds. 0 means never timeout 0 3.0.1 For the Chinese environment, the MySQL connection URL can usually be set to:jdbc:mysql://localhost:3306/test?user=root&password=&useunicode=true& Characterencoding=utf-8&autoreconnect=true&failoverreadonly=false in the case of a database connection pool, It is best to set the following two parameters: Autoreconnect=true&failoverreadonly=false

MySQL JDBC URL format

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.