Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

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)
connectionInitSqlsList of SQL Statements to be executed when a physical connection is first created. Comma separated. Changes have no effect after pool initialization.setConnectionInitSqls(Collection)
connectionPropertiesConnection properties.setConnectionProperties(String)
defaultAutoCommitDefault autocommit state. Should not matter for well-designed applications. Changes have no effect after pool initialization.setDefaultAutoCommit(boolean)
defaultCatalogDefault catalog name. Changes have no effect after pool initialization.setDefaultCatalog(String)
defaultReadOnly

Changes have no effect after pool initialization.

setDefaultReadOnly(boolean)
defaultTransactionIsolationChanges 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.
This allows for putting JDBC driver on the boot classloader of the OSGi container or creating fragment bundles, which supply JDBC drivers to the jdbc-provider bundle.

setDriverClassName(String)
initialSizeInitial size of the pool. Changes have no effect after pool initialization.setInitialSize(int)
maxActiveMaximum number of active connections that can be allocated at the same time. Use a negative value for no limit.setMaxActive(int)
maxIdleMaximum number of connections that can remain idle in the pool.setMaxIdle(int)
maxOpenPreparedStatementMaximum number of PreparedStatements to pool. Use a negative value for no limit. Changes have no effect after pool initialization.setMaxOpenPreparedStatements(int)
maxWaitUse a negative value for no limit.setMaxWait(long)
minEvictableIdleTimeMillisMinimum amount of time an object may sit idle in the pool.setMinEvictableIdleTimeMillis(long)
minIdleMinimum number of idle connections in the pool.setMinIdle(int)
datasource.<datasourcename>.passwordRequired. JDBC Password. Changes have no effect after pool initialization.setPassword(String)
poolPreparedStatementsWhether to pool statements or not. Changes have no effect after pool initialization.setPoolPreparedStatements(boolean)
removeAbandoned-setRemoveAbandoned(boolean)
removeAbandonedTimeout-setRemoveAbandonedTimeout(int)
testOnBorrowWether the validation query shall be executed before each "borrow" from the pool.setTestOnBorrow(boolean)
testOnReturnWether the validation query shall be executed when a connection is returned to the pool.setTestOnReturn(boolean)
testWhileIdleWether the validation query shall be executed regularily to keep the connection alive.setTestWhileIdle(boolean)
timeBetweenEvictionRunsMillis-setTimeBetweenEvictionRunsMillis(long)
datasource.<datasourcename>.urlRequired. 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>.usernameRequired. JDBC User. Changes have no effect after pool initialization.setUsername(String)
datasource.<datasourcename>.validationQueryRequired. 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.

  • No labels