Java org.apache.commons.dbcp BasicDataSource fields, constructors, methods, implement or subclass

Example usage for Java org.apache.commons.dbcp BasicDataSource fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for org.apache.commons.dbcp BasicDataSource.

The text is from its open source code.

Subclass

org.apache.commons.dbcp.BasicDataSource has subclasses.
Click this link to see all its subclasses.

Constructor

Method

voidaddConnectionProperty(String name, String value)
Add a custom connection property to the set that will be passed to our JDBC driver.
voidclose()
Close and release all connections that are currently stored in the connection pool associated with our data source.
ClassgetClass()
Returns the runtime class of this Object .
ConnectiongetConnection()
Create (if necessary) and return a connection to the database.
ConnectiongetConnection(String username, String password)
BasicDataSource does NOT support this method.
booleangetDefaultAutoCommit()
Returns the default auto-commit property.
StringgetDefaultCatalog()
Returns the default catalog.
booleangetDefaultReadOnly()
Returns the default readOnly property.
intgetDefaultTransactionIsolation()
Returns the default transaction isolation state of returned connections.
StringgetDriverClassName()
Returns the jdbc driver class name.
intgetInitialSize()
Returns the initial size of the connection pool.
booleangetLogAbandoned()

Flag to log stack traces for application code which abandoned a Statement or Connection.

PrintWritergetLogWriter()

Returns the log writer being used by this data source.

Calls #createDataSource() , so has the side effect of initializing the connection pool.

intgetMaxActive()

Returns the maximum number of active connections that can be allocated at the same time.

intgetMaxIdle()

Returns the maximum number of connections that can remain idle in the pool.

intgetMaxOpenPreparedStatements()
Gets the value of the #maxOpenPreparedStatements property.
longgetMaxWait()

Returns the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception.

longgetMinEvictableIdleTimeMillis()
Returns the #minEvictableIdleTimeMillis property.
intgetMinIdle()
Returns the minimum number of idle connections in the pool
intgetNumActive()
[Read Only] The current number of active connections that have been allocated from this data source.
intgetNumIdle()
[Read Only] The current number of idle connections that are waiting to be allocated from this data source.
intgetNumTestsPerEvictionRun()
Returns the value of the #numTestsPerEvictionRun property.
StringgetPassword()
Returns the password passed to the JDBC driver to establish connections.
booleangetRemoveAbandoned()
Flag to remove abandoned connections if they exceed the removeAbandonedTimout.
intgetRemoveAbandonedTimeout()
Timeout in seconds before an abandoned connection can be removed.
booleangetTestOnBorrow()
Returns the #testOnBorrow property.
booleangetTestOnReturn()
Returns the value of the #testOnReturn property.
booleangetTestWhileIdle()
Returns the value of the #testWhileIdle property.
longgetTimeBetweenEvictionRunsMillis()
Returns the value of the #timeBetweenEvictionRunsMillis property.
StringgetUrl()
Returns the JDBC connection #url property.
StringgetUsername()
Returns the JDBC connection #username property.
StringgetValidationQuery()
Returns the validation query used to validate connections before returning them.
booleanisAccessToUnderlyingConnectionAllowed()
Returns the value of the accessToUnderlyingConnectionAllowed property.
booleanisPoolPreparedStatements()
Returns true if we are pooling statements.
voidsetAccessToUnderlyingConnectionAllowed(boolean allow)

Sets the value of the accessToUnderlyingConnectionAllowed property.

voidsetDefaultAutoCommit(boolean defaultAutoCommit)

Sets default auto-commit state of connections returned by this datasource.

Note: this method currently has no effect once the pool has been initialized.

voidsetDefaultCatalog(String defaultCatalog)

Sets the default catalog.

Note: this method currently has no effect once the pool has been initialized.

voidsetDefaultReadOnly(boolean defaultReadOnly)

Sets defaultReadonly property.

Note: this method currently has no effect once the pool has been initialized.

voidsetDefaultTransactionIsolation(int defaultTransactionIsolation)

Sets the default transaction isolation state for returned connections.

Note: this method currently has no effect once the pool has been initialized.

voidsetDriverClassName(String driverClassName)

Sets the jdbc driver class name.

Note: this method currently has no effect once the pool has been initialized.

voidsetInitialSize(int initialSize)

Sets the initial size of the connection pool.

Note: this method currently has no effect once the pool has been initialized.

voidsetLogAbandoned(boolean logAbandoned)
voidsetLogWriter(PrintWriter logWriter)

Sets the log writer being used by this data source.

Calls #createDataSource() , so has the side effect of initializing the connection pool.

voidsetMaxActive(int maxActive)
Sets the maximum number of active connections that can be allocated at the same time.
voidsetMaxIdle(int maxIdle)
Sets the maximum number of connections that can remail idle in the pool.
voidsetMaxOpenPreparedStatements(int maxOpenStatements)

Sets the value of the #maxOpenPreparedStatements property.

Note: this method currently has no effect once the pool has been initialized.

voidsetMaxWait(long maxWait)
Sets the maxWait property.
voidsetMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)
Sets the #minEvictableIdleTimeMillis property.
voidsetMinIdle(int minIdle)
Sets the minimum number of idle connections in the pool.
voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
Sets the value of the #numTestsPerEvictionRun property.
voidsetPassword(String password)

Sets the #password .

Note: this method currently has no effect once the pool has been initialized.

voidsetPoolPreparedStatements(boolean poolingStatements)

Sets whether to pool statements or not.

Note: this method currently has no effect once the pool has been initialized.

voidsetRemoveAbandoned(boolean removeAbandoned)
voidsetRemoveAbandonedTimeout(int removeAbandonedTimeout)
voidsetTestOnBorrow(boolean testOnBorrow)
Sets the #testOnBorrow property.
voidsetTestOnReturn(boolean testOnReturn)
Sets the testOnReturn property.
voidsetTestWhileIdle(boolean testWhileIdle)
Sets the testWhileIdle property.
voidsetTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)
Sets the #timeBetweenEvictionRunsMillis property.
voidsetUrl(String url)

Sets the #url .

Note: this method currently has no effect once the pool has been initialized.

voidsetUsername(String username)

Sets the #username .

Note: this method currently has no effect once the pool has been initialized.

voidsetValidationQuery(String validationQuery)

Sets the #validationQuery .

Note: this method currently has no effect once the pool has been initialized.