Example usage for Java org.apache.commons.dbcp BasicDataSource fields, constructors, methods, implement or subclass
The text is from its open source code.
void | addConnectionProperty(String name, String value) Add a custom connection property to the set that will be passed to our JDBC driver. |
void | close() Close and release all connections that are currently stored in the connection pool associated with our data source. |
Class> | getClass() Returns the runtime class of this Object . |
Connection | getConnection() Create (if necessary) and return a connection to the database. |
Connection | getConnection(String username, String password) BasicDataSource does NOT support this method. |
boolean | getDefaultAutoCommit() Returns the default auto-commit property. |
String | getDefaultCatalog() Returns the default catalog. |
boolean | getDefaultReadOnly() Returns the default readOnly property. |
int | getDefaultTransactionIsolation() Returns the default transaction isolation state of returned connections. |
String | getDriverClassName() Returns the jdbc driver class name. |
int | getInitialSize() Returns the initial size of the connection pool. |
boolean | getLogAbandoned() Flag to log stack traces for application code which abandoned a Statement or Connection. |
PrintWriter | getLogWriter() Returns the log writer being used by this data source. Calls #createDataSource() , so has the side effect of initializing the connection pool. |
int | getMaxActive() Returns the maximum number of active connections that can be allocated at the same time. |
int | getMaxIdle() Returns the maximum number of connections that can remain idle in the pool. |
int | getMaxOpenPreparedStatements() Gets the value of the #maxOpenPreparedStatements property. |
long | getMaxWait() Returns the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception. |
long | getMinEvictableIdleTimeMillis() Returns the #minEvictableIdleTimeMillis property. |
int | getMinIdle() Returns the minimum number of idle connections in the pool |
int | getNumActive() [Read Only] The current number of active connections that have been allocated from this data source. |
int | getNumIdle() [Read Only] The current number of idle connections that are waiting to be allocated from this data source. |
int | getNumTestsPerEvictionRun() Returns the value of the #numTestsPerEvictionRun property. |
String | getPassword() Returns the password passed to the JDBC driver to establish connections. |
boolean | getRemoveAbandoned() Flag to remove abandoned connections if they exceed the removeAbandonedTimout. |
int | getRemoveAbandonedTimeout() Timeout in seconds before an abandoned connection can be removed. |
boolean | getTestOnBorrow() Returns the #testOnBorrow property. |
boolean | getTestOnReturn() Returns the value of the #testOnReturn property. |
boolean | getTestWhileIdle() Returns the value of the #testWhileIdle property. |
long | getTimeBetweenEvictionRunsMillis() Returns the value of the #timeBetweenEvictionRunsMillis property. |
String | getUrl() Returns the JDBC connection #url property. |
String | getUsername() Returns the JDBC connection #username property. |
String | getValidationQuery() Returns the validation query used to validate connections before returning them. |
boolean | isAccessToUnderlyingConnectionAllowed() Returns the value of the accessToUnderlyingConnectionAllowed property. |
boolean | isPoolPreparedStatements() Returns true if we are pooling statements. |
void | setAccessToUnderlyingConnectionAllowed(boolean allow) Sets the value of the accessToUnderlyingConnectionAllowed property. |
void | setDefaultAutoCommit(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. |
void | setDefaultCatalog(String defaultCatalog) Sets the default catalog. Note: this method currently has no effect once the pool has been initialized. |
void | setDefaultReadOnly(boolean defaultReadOnly) Sets defaultReadonly property. Note: this method currently has no effect once the pool has been initialized. |
void | setDefaultTransactionIsolation(int defaultTransactionIsolation) Sets the default transaction isolation state for returned connections. Note: this method currently has no effect once the pool has been initialized. |
void | setDriverClassName(String driverClassName) Sets the jdbc driver class name. Note: this method currently has no effect once the pool has been initialized. |
void | setInitialSize(int initialSize) Sets the initial size of the connection pool. Note: this method currently has no effect once the pool has been initialized. |
void | setLogAbandoned(boolean logAbandoned) |
void | setLogWriter(PrintWriter logWriter) Sets the log writer being used by this data source. Calls #createDataSource() , so has the side effect of initializing the connection pool. |
void | setMaxActive(int maxActive) Sets the maximum number of active connections that can be allocated at the same time. |
void | setMaxIdle(int maxIdle) Sets the maximum number of connections that can remail idle in the pool. |
void | setMaxOpenPreparedStatements(int maxOpenStatements) Sets the value of the #maxOpenPreparedStatements property. Note: this method currently has no effect once the pool has been initialized. |
void | setMaxWait(long maxWait) Sets the maxWait property. |
void | setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) Sets the #minEvictableIdleTimeMillis property. |
void | setMinIdle(int minIdle) Sets the minimum number of idle connections in the pool. |
void | setNumTestsPerEvictionRun(int numTestsPerEvictionRun) Sets the value of the #numTestsPerEvictionRun property. |
void | setPassword(String password) Sets the #password . Note: this method currently has no effect once the pool has been initialized. |
void | setPoolPreparedStatements(boolean poolingStatements) Sets whether to pool statements or not. Note: this method currently has no effect once the pool has been initialized. |
void | setRemoveAbandoned(boolean removeAbandoned) |
void | setRemoveAbandonedTimeout(int removeAbandonedTimeout) |
void | setTestOnBorrow(boolean testOnBorrow) Sets the #testOnBorrow property. |
void | setTestOnReturn(boolean testOnReturn) Sets the testOnReturn property. |
void | setTestWhileIdle(boolean testWhileIdle) Sets the testWhileIdle property. |
void | setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) Sets the #timeBetweenEvictionRunsMillis property. |
void | setUrl(String url) Sets the #url . Note: this method currently has no effect once the pool has been initialized. |
void | setUsername(String username) Sets the #username . Note: this method currently has no effect once the pool has been initialized. |
void | setValidationQuery(String validationQuery) Sets the #validationQuery . Note: this method currently has no effect once the pool has been initialized. |