Download dbcp 1.4




















This is not the only way to combine the commons-dbcp and commons-pool packages, but provides a "one stop shopping" solution for basic requirements. Users extending this class should take care to use appropriate accessors rather than accessing protected fields directly to ensure thread-safety.

Nielsen, Craig R. Connection getConnection Create if necessary and return a connection to the database.

String getDefaultCatalog Returns the default catalog. String getDriverClassName Returns the jdbc driver class name. PrintWriter getLogWriter Returns the log writer being used by this data source.

String getValidationQuery Returns the validation query used to validate connections before returning them. Object clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait Field Detail defaultAutoCommit protected volatile boolean defaultAutoCommit The default auto-commit state of connections created by this pool. If not specified, Class.

If specified, Class. If maxIdle is set too low on heavily loaded systems it is possible you will see connections being closed and almost immediately new connections being opened. This is a result of the active threads momentarily closing connections faster than they are opening them, causing the number of idle connections to rise above maxIdle.

The best value for maxIdle for heavily loaded system will vary but the default is a good starting point. Since: 1. When this property is set to true both PreparedStatements and CallableStatements are pooled.

Since a connection usually only uses one or two statements at a time, this is mostly used to help detect resource leaks. Note: As of version 1. String are pooled along with PreparedStatements produced by Connection. String and maxOpenPreparedStatements limits the total number of prepared or callable statements that may be in use at a given time. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.

When non-positive, no idle object evictor thread will be run. If an object fails to validate, it will be dropped from the pool. NOTE - The "user" and "password" properties will be passed explicitly, so they do not need to be included here.

Returns: true if default auto-commit is enabled setDefaultAutoCommit public 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. The pool is initialized the first time one of the following methods is invoked: getConnection, setLogwriter, setLoginTimeout, getLoginTimeout, getLogWriter.

Parameters: defaultReadOnly - default read-only value getDefaultTransactionIsolation public int getDefaultTransactionIsolation Returns the default transaction isolation state of returned connections. Returns: the default value for transaction isolation state See Also: Connection.

Parameters: defaultTransactionIsolation - the default transaction isolation state See Also: Connection. Returns null if no class loader has been explicitly specified. Parameters: driverClassLoader - the class loader with which to load the JDBC driver getMaxActive public int getMaxActive Returns the maximum number of active connections that can be allocated at the same time.

Returns: the maximum number of active connections setMaxActive public void setMaxActive int maxActive Sets the maximum number of active connections that can be allocated at the same time. Use a negative value for no limit. Returns: the maximum number of idle connections setMaxIdle public void setMaxIdle int maxIdle Sets the maximum number of connections that can remain idle in the pool.

Returns: the number of connections created when the pool is initialized setInitialSize public void setInitialSize int initialSize Sets the initial size of the connection pool. Parameters: initialSize - the number of connections created when the pool is initialized getMaxWait public long getMaxWait Returns the maximum number of milliseconds that the pool will wait for a connection to be returned before throwing an exception.

Returns: true if prepared and callable statements are pooled setPoolPreparedStatements public void setPoolPreparedStatements boolean poolingStatements Sets whether to pool statements or not. This property determines whether or not the pool will validate objects before they are borrowed from the pool.

This Commons package provides an opportunity to coordinate the efforts required to create and maintain an efficient, feature-rich package under the ASF license. The commons-dbcp2 artifact relies on code in the commons-pool2 artifact to provide the underlying object pool mechanisms. Here is how it works:. Users upgrading to 2. Users should also be aware that some configuration options e.

There is no difference in the codebase supporting DBCP 1. See the downloads page for information on obtaining releases. The Javadoc API documents are available online. In particular, you should read the package overview of the org. There are several examples of using DBCP available.

All Rights Reserved.



0コメント

  • 1000 / 1000