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