| Configuration |
Default value |
Description |
| Name |
|
The point of configuring this property is that if there are multiple data sources, the monitoring can be distinguished by name.
If not configured, a name will be generated with the format: "datasource-" + system.identityhashcode (This) |
| Jdbcurl |
|
The URL of the connection database is different from the database. For example:
Mysql:jdbc:mysql://10.20.153.104:3306/druid2
Oracle:jdbc:oracle:thin:@10.20.149.85:1521:ocnauto |
| Username |
|
User name of the connection database |
| Password |
|
The password for the connection database. If you do not want the password to be written directly in the configuration file, you can use Configfilter. See more here: Https://github.com/alibaba/druid/wiki/%E4%BD%BF%E7%94%A8ConfigFilter |
| Driverclassname |
Automatic recognition by URL |
This one can not be matched, if not configured Druid will automatically identify the dbtype based on the URL, and then select the appropriate driverclassname (under the recommended configuration) |
| InitialSize |
0 |
The number of physical connections that were established when initializing. Initialization occurs when a call to the Init method is displayed, or the first time getconnection |
| Maxactive |
8 |
Maximum number of connection pools |
| Maxidle |
8 |
is no longer in use, configured and no effect |
| Minidle |
|
Minimum number of connection pools |
| Maxwait |
|
Gets the maximum wait time, in milliseconds, for a connection. After Maxwait is configured, a fair lock is enabled by default, and concurrency efficiency decreases, and if necessary, an unfair lock can be used by configuring the Useunfairlock property to True. |
| Poolpreparedstatements |
False |
Whether to cache PreparedStatement, that is, Pscache. Pscache has a huge performance boost for cursors-enabled databases, such as Oracle. It is recommended to close under MySQL. |
| Maxopenpreparedstatements |
-1 |
To enable Pscache, it must be configured to be greater than 0 when the Poolpreparedstatements Auto trigger is modified to true when it is greater than 0 o'clock. In Druid, there is no problem that Oracle Pscache takes up too much memory, so you can configure this value a bit larger, say 100. |
| Validationquery |
|
The SQL that is used to detect whether a connection is valid is a query statement. If the validationquery for Null,testonborrow, Testonreturn, Testwhileidle will not function. |
| Testonborrow |
True |
When you request a connection, perform a validationquery to detect if the connection is valid, and this configuration will degrade performance. |
| Testonreturn |
False |
When you return the connection, perform validationquery to detect if the connection is valid, and this configuration will degrade performance |
| Testwhileidle |
False |
It is recommended to configure true to not affect performance and ensure security. When applying for connection detection, if idle time is greater than Timebetweenevictionrunsmillis, perform validationquery to detect if the connection is valid. |
| Timebetweenevictionrunsmillis |
|
There are two meanings:
1) Destroy thread will detect the connection time interval 2) Testwhileidle the basis of the judgment, detailed see Testwhileidle attribute description |
| Numtestsperevictionrun |
|
No longer used, a druiddatasource only supports one Evictionrun |
| Minevictableidletimemillis |
|
|
| Connectioninitsqls |
|
SQL executed when the physical connection is initialized |
| Exceptionsorter |
Automatic identification according to DBTYPE |
Discard the connection when the database throws some unrecoverable exceptions |
| Filters |
|
The property type is a string, and the extension is configured by alias, and the commonly used plugins are:
Filter:stat Log for monitoring statistics with FILTER:LOG4J defense SQL injection Filter:wall |
| Proxyfilters |
|
The type is list<com.alibaba.druid.filter.filter> if both filters and Proxyfilters are configured, it is a composite relationship, not a replacement relationship |