BasicDataSource configuration parameter.
Parameters |
Description |
Username |
User name passed to the JDBC driver for connection Establishment |
Password |
The password passed to the JDBC driver for establishing the connection |
Url |
URL passed to the JDBC driver for connection Establishment |
DriverClassName |
Complete and valid java class name of the JDBC driver used |
ConnectionProperties |
The connection parameters sent to the JDBC driver when a new connection is established, The format must be [propertyName = property;] * Note: The user/password parameter will be passed explicitly, so it is not required here. |
Parameters |
Default Value |
Description |
DefaultAutoCommit |
Driver default |
Default auto-commit status of the connection created in the connection pool |
DefaultReadOnly |
Driver default |
The default read-only status of the connection created in the connection pool. If no value is set, the setReadOnly method will not be called. (Some drivers do not support read-only mode, such as Informix) |
DefaultTransactionIsolation |
Driver default |
The default TransactionIsolation status of the connection created in the connection pool. One of the following lists: (refer to javadoc)* NONE * READ_COMMITTED * READ_UNCOMMITTED * REPEATABLE_READ * SERIALIZABLE |
DefaultCatalog |
|
Default catalog of the connection created in the connection pool |
Parameters |
Default Value |
Description |
InitialSize |
0 |
Initialize the connection:The number of initial connections created when the connection pool is started. supported after version 1.2 |
MaxActive |
8 |
Maximum active connections: Maximum number of active connections that can be allocated by the connection pool at the same time, If it is set to a non-positive number, it indicates no limit. |
MaxIdle |
8 |
Maximum idle connections: The maximum number of connections allowed to remain idle in the connection pool. idle connections exceeding the limit will be released, If it is set to a negative number, it indicates no restriction. |
MinIdle |
0 |
Minimum idle connection: The minimum number of connections allowed to remain idle in the connection pool. If the number is lower than this, a new connection will be created, If it is set to 0, it is not created. |
MaxWait |
Unlimited |
Maximum wait time: Maximum time (in milliseconds) the connection pool waits for the connection to be returned when no connection is available ), An exception is thrown when the time limit is exceeded. If it is set to-1, it indicates unlimited waiting. |
Parameters |
Default Value |
Description |
ValidationQuery |
|
SQL query is used to verify the connection retrieved from the connection pool. If it is specified before the connection is returned to the caller, The query must be an SQL SELECT statement and at least one row of records must be returned. |
TestOnBorrow |
True |
Indicates whether to perform a test before removing the connection from the pool. If the test fails, Remove the connection from the pool and try to retrieve another one. Note: If this parameter is set to true, the validationQuery parameter must be set to a non-null string. |
TestOnReturn |
False |
Indicates whether to perform a test before return to the pool Note: If this parameter is set to true, the validationQuery parameter must be set to a non-null string. |
TestWhileIdle |
False |
Checks whether the connection is idle (if any). If the check fails, The connection is removed from the pool. Note: If this parameter is set to true, the validationQuery parameter must be set to a non-null string. |
TimeBetweenEvictionRunsMillis |
-1 |
The time value of sleep during idle connection to the recycler thread running, in milliseconds. If this parameter is set to a non-positive value, the idle connection to the recycler thread is not run. |
NumTestsPerEvictionRun |
3 |
Number of connections checked during each idle connection to the recycler thread (if any) |
MinEvictableIdleTimeMillis |
1000*60*30 |
The connection stays idle in the pool and is not idle in the connection to the recycler thread. (If any) minimum time for recycling, in milliseconds |
Parameters |
Default Value |
Description |
PoolPreparedStatements |
False |
Enable the prepared statement pool function of the pool. |
MaxOpenPreparedStatements |
Unlimited |
The maximum number of statements that can be allocated at the same time by the statement pool, If it is set to 0, it indicates no restriction. |
The PreparedStatements pool can be enabled here. When enabled, a statement pool will be created for each connection,
The PreparedStatements created by the following method will be cached:
* Public PreparedStatement prepareStatement (String SQL)
* Public PreparedStatement prepareStatement (String SQL, int resultSetType, int resultSetConcurrency)
Note:Confirm that there are other resources available for the connection.
Parameters |
Default Value |
Description |
AccessToUnderlyingConnectionAllowed |
False |
Controls whether PoolGuard allows access to underlying connections |
If yes, you can use the following method to obtain the underlying connection:
Connection conn = ds. getConnection ();
Connection dconn = (DelegatingConnection) conn). getInnermostDelegate ();
...
Conn. close ();
By default, false is disabled. This is a potentially dangerous function. Improper encoding may cause damage.
(Disable the underlying connection or continue to use it when the daemon connection is closed). Use it with caution,
It is used only when you need to directly access the specific features of the driver.
Note:Do not close the underlying connection. You can only close the previous one.
Parameters |
Default Value |
Description |
RemoveAbandoned |
False |
Mark whether to delete the leaked connection if they exceed the removeAbandonedTimout limit. If this parameter is set to true, the connection is considered leaked and can be deleted. If the idle time exceeds removeAbandonedTimeout. If it is set to true, it can be used to fix the database connection for a program with no closed connection. |
RemoveAbandonedTimeout |
300 |
Timeout value that the leaked connection can be deleted, in seconds |
LogAbandoned |
False |
Indicates whether to print the stack trace log of the program when the Statement or connection is leaked. The leaked Statements and connection logs are added to each connection to open or generate a new Statement, Because stack trace needs to be generated. |
If "removeAbandoned" is enabled, the connection may be recycled by the pool when it is considered to be leaked. this mechanism is triggered when (getNumIdle () <2) and (getNumActive ()> getMaxActive ()-3.
For example, if maxActive = 20, active connection is 18, and idle connection is 1, "removeAbandoned" can be triggered ".
However, the active connection is deleted only when it is not used for more than "removeAbandonedTimeout". The default value is 300 seconds.
Traveling in the resultset is not calculated as being used.