Database Connection Parameters
Function Prototype
- DriverManager.getConnection(String url)
- DriverManager.getConnection(String url, Properties info)
- DriverManager.getConnection(String url, String user, String password)
Connection Parameters
|
Parameter |
Description |
|---|---|
|
url |
Database connection descriptor of the MySQL JDBC driver. The format is as follows: jdbc:mysql://host:port/database jdbc:mysql://host:port/database?param1=value1¶m2=value2
NOTE:
|
|
info |
Database connection attribute. For details, see Connection Attributes of the info Parameter. |
|
user |
Database user. |
|
password |
Password of the database user. |
Connection Attributes of the info Parameter
All connection attribute names of the info parameter are case-sensitive. Table 2 describes the common attributes.
|
Attribute |
Description |
Value |
|---|---|---|
|
user |
It specifies the database user who creates the connection. |
Attribute type: STRING |
|
password |
It specifies the password of the database user. |
Attribute type: STRING |
|
useSSL |
It specifies that the database is connected in SSL mode. |
Attribute type: BOOLEAN Value range:
|
|
verifyServerCertificate |
It specifies whether the client verifies the server certificate when the database is connected in SSL mode. |
Attribute type: BOOLEAN Value range:
Default value: true |
|
trustCertificateKeyStoreUrl |
It specifies the URL of the trusted root certificate keystore. |
Attribute type: STRING |
|
trustCertificateKeyStoreType |
It specifies the key storage type of the trusted root certificate. |
Attribute type: STRING Default value: JKS |
|
trustCertificateKeyStorePassword |
It specifies the password of the trusted root certificate keystore. |
Attribute type: STRING |
|
clientCertificateKeyStoreUrl |
It specifies the URL of the client certificate keystore. |
Attribute type: STRING |
|
clientCertificateKeyStoreType |
It specifies the key storage type of the client certificate keystore. |
Attribute type: STRING Default value: JKS |
|
clientCertificateKeyStorePassword |
It specifies the password of the client certificate keystore. |
Attribute type: STRING |
|
allowPublicKeyRetrieval |
It specifies whether the client obtains the public key from the server. |
Attribute type: BOOLEAN Value range:
Default value: false |
|
rewriteBatchedStatements |
It specifies whether SQL statements that are batch executed can be rewritten. |
Attribute type: BOOLEAN Value range:
Default value: false |
|
allowMultiQueries |
It specifies whether multiple SQL statements can be batch executed. |
Attribute type: BOOLEAN Value range:
Default value: false |
|
autoReconnect |
It specifies whether the client automatically reconnects to the server after connection interruption. |
Attribute type: BOOLEAN Value range:
Default value: false |
|
useUnicode |
It specifies whether the Unicode encoding is used. |
Attribute type: BOOLEAN Value range:
Default value: false |
|
characterEncoding |
It specifies the character set.
NOTE:
The character set on the client must be the same as that on the server. If this parameter is not set, for driver 8.0.25 and earlier, the client attempts to use the default character set of the server. For driver 8.0.26 or later, the client uses the default sorting rule of UTF8mb4. |
Attribute type: STRING |
|
connectTimeout |
It specifies the timeout interval for connecting to a server OS. If the time taken to connect to a server OS exceeds the value specified, the connection is interrupted. When multiple IP addresses are configured in the URL, it indicates the timeout interval for connecting to a single IP address. |
Attribute type: INTEGER Unit: ms Value range: 0 to 2147483647. The value 0 indicates that no timeout occurs. Default value: 0 |
|
socketTimeout |
It specifies the timeout interval for a socket read operation. If the time taken to read data from a server exceeds the value specified, the connection is closed. |
Attribute type: INTEGER Unit: ms Value range: 0 to 2147483647. The value 0 indicates that no timeout occurs. Default value: 0 |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot