Introduction
In most usecases, only the required configuration keys of DataSources will be used: url
, username
, password
, validationQuery
.
The following chapter provides a full list of supported key name patterns.
Ful list of org.clazzes.jdbc.provider datasource configuration keys
The JDBC-Provider supplies applications with Instances of org.apache.commons.dbcp.BasicDataSource from Apache's commons-dbcp project, therefore most values go right into it's setters.
Key | Description | Ac. BasicDataSource setter |
---|---|---|
accessToUnderlyingConnectionAllowed | Should not matter. Changes have no effect after pool initialization. | setAccessToUnderlyingConnectionAllowed(boolean) |
connectionInitSqls | List of SQL Statements to be executed when a physical connection is first created. Comma separated. Changes have no effect after pool initialization. | setConnectionInitSqls(Collection) |
connectionProperties | Connection properties. | setConnectionProperties(String) |
defaultAutoCommit | Default autocommit state. Should not matter for well-designed applications. Changes have no effect after pool initialization. | setDefaultAutoCommit(boolean) |
defaultCatalog | Default catalog name. Changes have no effect after pool initialization. | setDefaultCatalog(String) |
defaultReadOnly | Changes have no effect after pool initialization. | setDefaultReadOnly(boolean) |
defaultTransactionIsolation | Changes have no effect after pool initialization. | setDefaultTransactionIsolation(int) |
datasource.<datasourcename>.driverClassName | Optional for common database backends. Name of the database driver to use. For MySQL, MSSQL, PostgreSQL and Oracle the driver class name is automatically deduced from the JDBC URL. The class is resolved using the class loader of the jdbc-provider bundle. | setDriverClassName(String) |
initialSize | Initial size of the pool. Changes have no effect after pool initialization. | setInitialSize(int) |
maxActive | Maximum number of active connections that can be allocated at the same time. Use a negative value for no limit. | setMaxActive(int) |
maxIdle | Maximum number of connections that can remain idle in the pool. | setMaxIdle(int) |
maxOpenPreparedStatement | Maximum number of PreparedStatements to pool. Use a negative value for no limit. Changes have no effect after pool initialization. | setMaxOpenPreparedStatements(int) |
maxWait | Use a negative value for no limit. | setMaxWait(long) |
minEvictableIdleTimeMillis | Minimum amount of time an object may sit idle in the pool. | setMinEvictableIdleTimeMillis(long) |
minIdle | Minimum number of idle connections in the pool. | setMinIdle(int) |
datasource.<datasourcename>.password | Required. JDBC Password. Changes have no effect after pool initialization. | setPassword(String) |
poolPreparedStatements | Whether to pool statements or not. Changes have no effect after pool initialization. | setPoolPreparedStatements(boolean) |
removeAbandoned | - | setRemoveAbandoned(boolean) |
removeAbandonedTimeout | - | setRemoveAbandonedTimeout(int) |
testOnBorrow | Wether the validation query shall be executed before each "borrow" from the pool. | setTestOnBorrow(boolean) |
testOnReturn | Wether the validation query shall be executed when a connection is returned to the pool. | setTestOnReturn(boolean) |
testWhileIdle | Wether the validation query shall be executed regularily to keep the connection alive. | setTestWhileIdle(boolean) |
timeBetweenEvictionRunsMillis | - | setTimeBetweenEvictionRunsMillis(long) |
datasource.<datasourcename>.url | Required. JDBC URL. JDBC URL examples for common databases can be found in our JDBC Snippets. Changes have no effect after pool initialization. | setUrl(String) |
datasource.<datasourcename>.username | Required. JDBC User. Changes have no effect after pool initialization. | setUsername(String) |
datasource.<datasourcename>.validationQuery | Required. Validation query, executed to ensure the application receives a valid connection. Common validation queries can be found in our JDBC Snippets. | setValidationQuery(String) |
For more supported key patterns take a look at the JavaDoc of the org.clazzes.util.jdbc.provider.JdbcProvider class.
Typical JDBC URLs and validation queries can be found in our JDBC Snippets.