Java Doc for BasicDataSource.java in  » Database-JDBC-Connection-Pool » Connection-Pool-DBCP » org » apache » commons » dbcp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » Connection Pool DBCP » org.apache.commons.dbcp 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.dbcp.BasicDataSource

BasicDataSource
public class BasicDataSource implements DataSource(Code)

Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. 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.


author:
   Glenn L. Nielsen
author:
   Craig R. McClanahan
author:
   Dirk Verbeeck
version:
   $Revision: 506087 $ $Date: 2007-02-11 11:37:43 -0700 (Sun, 11 Feb 2007) $


Field Summary
protected  GenericObjectPoolconnectionPool
     The object pool that internally manages our connections.
protected  PropertiesconnectionProperties
     The connection properties that will be sent to our JDBC driver when establishing new connections.
protected  DataSourcedataSource
     The data source we will use to manage connections.
protected  booleandefaultAutoCommit
     The default auto-commit state of connections created by this pool.
protected  StringdefaultCatalog
     The default "catalog" of connections created by this pool.
protected  BooleandefaultReadOnly
     The default read-only state of connections created by this pool.
protected  intdefaultTransactionIsolation
     The default TransactionIsolation state of connections created by this pool.
protected  StringdriverClassName
     The fully qualified Java class name of the JDBC driver to be used.
protected  intinitialSize
     The initial number of connections that are created when the pool is started.
protected  PrintWriterlogWriter
     The PrintWriter to which log messages should be directed.
protected  intmaxActive
     The maximum number of active connections that can be allocated from this pool at the same time, or non-positive for no limit.
protected  intmaxIdle
     The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.
protected  intmaxOpenPreparedStatements
     The maximum number of open statements that can be allocated from the statement pool at the same time, or non-positive for no limit.
protected  longmaxWait
     The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely.
protected  longminEvictableIdleTimeMillis
     The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
protected  intminIdle
     The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none.
protected  intnumTestsPerEvictionRun
     The number of objects to examine during each run of the idle object evictor thread (if any).
protected  Stringpassword
     The connection password to be passed to our JDBC driver to establish a connection.
protected  booleanpoolPreparedStatements
     Prepared statement pooling for this pool.
protected  booleantestOnBorrow
     The indication of whether objects will be validated before being borrowed from the pool.
protected  booleantestOnReturn
     The indication of whether objects will be validated before being returned to the pool.
protected  booleantestWhileIdle
     The indication of whether objects will be validated by the idle object evictor (if any).
protected  longtimeBetweenEvictionRunsMillis
     The number of milliseconds to sleep between runs of the idle object evictor thread.
protected  Stringurl
     The connection URL to be passed to our JDBC driver to establish a connection.
protected  Stringusername
     The connection username to be passed to our JDBC driver to establish a connection.
protected  StringvalidationQuery
     The SQL query that will be used to validate connections from this pool before returning them to the caller.


Method Summary
public  voidaddConnectionProperty(String name, String value)
     Add a custom connection property to the set that will be passed to our JDBC driver.
public synchronized  voidclose()
     Close and release all connections that are currently stored in the connection pool associated with our data source.
protected synchronized  DataSourcecreateDataSource()
    

Create (if necessary) and return the internal data source we are using to manage our connections.

IMPLEMENTATION NOTE - It is tempting to use the "double checked locking" idiom in an attempt to avoid synchronizing on every single call to this method.

public  ConnectiongetConnection()
     Create (if necessary) and return a connection to the database.
public  ConnectiongetConnection(String username, String password)
     BasicDataSource does NOT support this method.
public synchronized  booleangetDefaultAutoCommit()
     Returns the default auto-commit property.
public synchronized  StringgetDefaultCatalog()
     Returns the default catalog.
public synchronized  booleangetDefaultReadOnly()
     Returns the default readOnly property.
public synchronized  intgetDefaultTransactionIsolation()
     Returns the default transaction isolation state of returned connections.
public synchronized  StringgetDriverClassName()
     Returns the jdbc driver class name.
public synchronized  intgetInitialSize()
     Returns the initial size of the connection pool.
public  booleangetLogAbandoned()
    

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

Defaults to false.

public  PrintWritergetLogWriter()
    
public  intgetLoginTimeout()
    

Returns the login timeout (in seconds) for connecting to the database.

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


throws:
  SQLException - if a database access error occurs
throws:
  UnsupportedOperationException - If the DataSource implementationdoes not support the login timeout feature.
public synchronized  intgetMaxActive()
    

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

public synchronized  intgetMaxIdle()
    

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

public synchronized  intgetMaxOpenPreparedStatements()
     Gets the value of the BasicDataSource.maxOpenPreparedStatements property.
public synchronized  longgetMaxWait()
    

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

public synchronized  longgetMinEvictableIdleTimeMillis()
     Returns the BasicDataSource.minEvictableIdleTimeMillis property.
public synchronized  intgetMinIdle()
    
public synchronized  intgetNumActive()
     [Read Only] The current number of active connections that have been allocated from this data source.
public synchronized  intgetNumIdle()
     [Read Only] The current number of idle connections that are waiting to be allocated from this data source.
public synchronized  intgetNumTestsPerEvictionRun()
     Returns the value of the BasicDataSource.numTestsPerEvictionRun property.
public synchronized  StringgetPassword()
     Returns the password passed to the JDBC driver to establish connections.
public  booleangetRemoveAbandoned()
     Flag to remove abandoned connections if they exceed the removeAbandonedTimout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.
public  intgetRemoveAbandonedTimeout()
     Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds.
public synchronized  booleangetTestOnBorrow()
     Returns the BasicDataSource.testOnBorrow property.
public synchronized  booleangetTestOnReturn()
     Returns the value of the BasicDataSource.testOnReturn property.
public synchronized  booleangetTestWhileIdle()
     Returns the value of the BasicDataSource.testWhileIdle property.
public synchronized  longgetTimeBetweenEvictionRunsMillis()
     Returns the value of the BasicDataSource.timeBetweenEvictionRunsMillis property.
public synchronized  StringgetUrl()
     Returns the JDBC connection BasicDataSource.url property.
public synchronized  StringgetUsername()
     Returns the JDBC connection BasicDataSource.username property.
public synchronized  StringgetValidationQuery()
     Returns the validation query used to validate connections before returning them.
public synchronized  booleanisAccessToUnderlyingConnectionAllowed()
     Returns the value of the accessToUnderlyingConnectionAllowed property.
public synchronized  booleanisPoolPreparedStatements()
     Returns true if we are pooling statements.
public  voidremoveConnectionProperty(String name)
     Remove a custom connection property.
public synchronized  voidsetAccessToUnderlyingConnectionAllowed(boolean allow)
    

Sets the value of the accessToUnderlyingConnectionAllowed property. It controls if the PoolGuard allows access to the underlying connection. (Default: false)

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

public synchronized  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.

public synchronized  voidsetDefaultCatalog(String defaultCatalog)
    

Sets the default catalog.

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

public synchronized  voidsetDefaultReadOnly(boolean defaultReadOnly)
    

Sets defaultReadonly property.

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

public synchronized  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.

public synchronized  voidsetDriverClassName(String driverClassName)
    

Sets the jdbc driver class name.

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

public synchronized  voidsetInitialSize(int initialSize)
    

Sets the initial size of the connection pool.

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

public  voidsetLogAbandoned(boolean logAbandoned)
    
public  voidsetLogWriter(PrintWriter logWriter)
    
public  voidsetLoginTimeout(int loginTimeout)
    
public synchronized  voidsetMaxActive(int maxActive)
     Sets the maximum number of active connections that can be allocated at the same time.
public synchronized  voidsetMaxIdle(int maxIdle)
     Sets the maximum number of connections that can remail idle in the pool.
public synchronized  voidsetMaxOpenPreparedStatements(int maxOpenStatements)
    

Sets the value of the BasicDataSource.maxOpenPreparedStatements property.

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

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

Sets the BasicDataSource.password .

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

public synchronized  voidsetPoolPreparedStatements(boolean poolingStatements)
    

Sets whether to pool statements or not.

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

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

Sets the BasicDataSource.url .

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

public synchronized  voidsetUsername(String username)
    

Sets the BasicDataSource.username .

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

public synchronized  voidsetValidationQuery(String validationQuery)
    

Sets the BasicDataSource.validationQuery .

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


Field Detail
connectionPool
protected GenericObjectPool connectionPool(Code)
The object pool that internally manages our connections.



connectionProperties
protected Properties connectionProperties(Code)
The connection properties that will be sent to our JDBC driver when establishing new connections. NOTE - The "user" and "password" properties will be passed explicitly, so they do not need to be included here.



dataSource
protected DataSource dataSource(Code)
The data source we will use to manage connections. This object should be acquired ONLY by calls to the createDataSource() method.



defaultAutoCommit
protected boolean defaultAutoCommit(Code)
The default auto-commit state of connections created by this pool.



defaultCatalog
protected String defaultCatalog(Code)
The default "catalog" of connections created by this pool.



defaultReadOnly
protected Boolean defaultReadOnly(Code)
The default read-only state of connections created by this pool.



defaultTransactionIsolation
protected int defaultTransactionIsolation(Code)
The default TransactionIsolation state of connections created by this pool.



driverClassName
protected String driverClassName(Code)
The fully qualified Java class name of the JDBC driver to be used.



initialSize
protected int initialSize(Code)
The initial number of connections that are created when the pool is started.
since:
   1.2



logWriter
protected PrintWriter logWriter(Code)
The PrintWriter to which log messages should be directed.



maxActive
protected int maxActive(Code)
The maximum number of active connections that can be allocated from this pool at the same time, or non-positive for no limit.



maxIdle
protected int maxIdle(Code)
The maximum number of connections that can remain idle in the pool, without extra ones being released, or negative for no limit.



maxOpenPreparedStatements
protected int maxOpenPreparedStatements(Code)
The maximum number of open statements that can be allocated from the statement pool at the same time, or non-positive for no limit. Since a connection usually only uses one or two statements at a time, this is mostly used to help detect resource leaks.



maxWait
protected long maxWait(Code)
The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception, or -1 to wait indefinitely.



minEvictableIdleTimeMillis
protected long minEvictableIdleTimeMillis(Code)
The minimum amount of time an object may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).



minIdle
protected int minIdle(Code)
The minimum number of active connections that can remain idle in the pool, without extra ones being created, or 0 to create none.



numTestsPerEvictionRun
protected int numTestsPerEvictionRun(Code)
The number of objects to examine during each run of the idle object evictor thread (if any).



password
protected String password(Code)
The connection password to be passed to our JDBC driver to establish a connection.



poolPreparedStatements
protected boolean poolPreparedStatements(Code)
Prepared statement pooling for this pool.



testOnBorrow
protected boolean testOnBorrow(Code)
The indication of whether objects will be validated before being borrowed from the pool. If the object fails to validate, it will be dropped from the pool, and we will attempt to borrow another.



testOnReturn
protected boolean testOnReturn(Code)
The indication of whether objects will be validated before being returned to the pool.



testWhileIdle
protected boolean testWhileIdle(Code)
The indication of whether objects will be validated by the idle object evictor (if any). If an object fails to validate, it will be dropped from the pool.



timeBetweenEvictionRunsMillis
protected long timeBetweenEvictionRunsMillis(Code)
The number of milliseconds to sleep between runs of the idle object evictor thread. When non-positive, no idle object evictor thread will be run.



url
protected String url(Code)
The connection URL to be passed to our JDBC driver to establish a connection.



username
protected String username(Code)
The connection username to be passed to our JDBC driver to establish a connection.



validationQuery
protected String validationQuery(Code)
The SQL query that will be used to validate connections from this pool before returning them to the caller. If specified, this query MUST be an SQL SELECT statement that returns at least one row.





Method Detail
addConnectionProperty
public void addConnectionProperty(String name, String value)(Code)
Add a custom connection property to the set that will be passed to our JDBC driver. This MUST be called before the first connection is retrieved (along with all the other configuration property setters). Calls to this method after the connection pool has been initialized have no effect.
Parameters:
  name - Name of the custom connection property
Parameters:
  value - Value of the custom connection property



close
public synchronized void close() throws SQLException(Code)
Close and release all connections that are currently stored in the connection pool associated with our data source.
throws:
  SQLException - if a database error occurs



createDataSource
protected synchronized DataSource createDataSource() throws SQLException(Code)

Create (if necessary) and return the internal data source we are using to manage our connections.

IMPLEMENTATION NOTE - It is tempting to use the "double checked locking" idiom in an attempt to avoid synchronizing on every single call to this method. However, this idiom fails to work correctly in the face of some optimizations that are legal for a JVM to perform.


throws:
  SQLException - if the object pool cannot be created.



getConnection
public Connection getConnection() throws SQLException(Code)
Create (if necessary) and return a connection to the database.
throws:
  SQLException - if a database access error occurs a database connection



getConnection
public Connection getConnection(String username, String password) throws SQLException(Code)
BasicDataSource does NOT support this method.
Parameters:
  username - Database user on whose behalf the Connectionis being made
Parameters:
  password - The database user's password
throws:
  UnsupportedOperationException -
throws:
  SQLException - if a database access error occurs nothing - always throws UnsupportedOperationException



getDefaultAutoCommit
public synchronized boolean getDefaultAutoCommit()(Code)
Returns the default auto-commit property. true if default auto-commit is enabled



getDefaultCatalog
public synchronized String getDefaultCatalog()(Code)
Returns the default catalog. the default catalog



getDefaultReadOnly
public synchronized boolean getDefaultReadOnly()(Code)
Returns the default readOnly property. true if connections are readOnly by default



getDefaultTransactionIsolation
public synchronized int getDefaultTransactionIsolation()(Code)
Returns the default transaction isolation state of returned connections. the default value for transaction isolation state
See Also:   Connection.getTransactionIsolation



getDriverClassName
public synchronized String getDriverClassName()(Code)
Returns the jdbc driver class name. the jdbc driver class name



getInitialSize
public synchronized int getInitialSize()(Code)
Returns the initial size of the connection pool. the number of connections created when the pool is initialized



getLogAbandoned
public boolean getLogAbandoned()(Code)

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

Defaults to false.

Logging of abandoned Statements and Connections adds overhead for every Connection open or new Statement because a stack trace has to be generated.




getLogWriter
public PrintWriter getLogWriter() throws SQLException(Code)

Returns the log writer being used by this data source.

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


throws:
  SQLException - if a database access error occurs log writer in use



getLoginTimeout
public int getLoginTimeout() throws SQLException(Code)

Returns the login timeout (in seconds) for connecting to the database.

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


throws:
  SQLException - if a database access error occurs
throws:
  UnsupportedOperationException - If the DataSource implementationdoes not support the login timeout feature. login timeout in seconds



getMaxActive
public synchronized int getMaxActive()(Code)

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

A non-positive number means that there is no limit.

the maximum number of active connections



getMaxIdle
public synchronized int getMaxIdle()(Code)

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

A negative value indicates that there is no limit

the maximum number of idle connections



getMaxOpenPreparedStatements
public synchronized int getMaxOpenPreparedStatements()(Code)
Gets the value of the BasicDataSource.maxOpenPreparedStatements property. the maximum number of open statements
See Also:   BasicDataSource.maxOpenPreparedStatements



getMaxWait
public synchronized long getMaxWait()(Code)

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

Returns -1 if the pool is set to wait indefinitely.

the maxWait property value



getMinEvictableIdleTimeMillis
public synchronized long getMinEvictableIdleTimeMillis()(Code)
Returns the BasicDataSource.minEvictableIdleTimeMillis property. the value of the BasicDataSource.minEvictableIdleTimeMillis property
See Also:   BasicDataSource.minEvictableIdleTimeMillis



getMinIdle
public synchronized int getMinIdle()(Code)
Returns the minimum number of idle connections in the pool the minimum number of idle connections
See Also:   GenericObjectPool.getMinIdle



getNumActive
public synchronized int getNumActive()(Code)
[Read Only] The current number of active connections that have been allocated from this data source. the current number of active connections



getNumIdle
public synchronized int getNumIdle()(Code)
[Read Only] The current number of idle connections that are waiting to be allocated from this data source. the current number of idle connections



getNumTestsPerEvictionRun
public synchronized int getNumTestsPerEvictionRun()(Code)
Returns the value of the BasicDataSource.numTestsPerEvictionRun property. the number of objects to examine during idle object evictorruns
See Also:   BasicDataSource.numTestsPerEvictionRun



getPassword
public synchronized String getPassword()(Code)
Returns the password passed to the JDBC driver to establish connections. the connection password



getRemoveAbandoned
public boolean getRemoveAbandoned()(Code)
Flag to remove abandoned connections if they exceed the removeAbandonedTimout. Set to true or false, default false. If set to true a connection is considered abandoned and eligible for removal if it has been idle longer than the removeAbandonedTimeout. Setting this to true can recover db connections from poorly written applications which fail to close a connection.



getRemoveAbandonedTimeout
public int getRemoveAbandonedTimeout()(Code)
Timeout in seconds before an abandoned connection can be removed. Defaults to 300 seconds. abandoned connection timeout



getTestOnBorrow
public synchronized boolean getTestOnBorrow()(Code)
Returns the BasicDataSource.testOnBorrow property. true if objects are validated before being borrowed from thepool
See Also:   BasicDataSource.testOnBorrow



getTestOnReturn
public synchronized boolean getTestOnReturn()(Code)
Returns the value of the BasicDataSource.testOnReturn property. true if objects are validated before being returned to thepool
See Also:   BasicDataSource.testOnReturn



getTestWhileIdle
public synchronized boolean getTestWhileIdle()(Code)
Returns the value of the BasicDataSource.testWhileIdle property. true if objects examined by the idle object evictor arevalidated
See Also:   BasicDataSource.testWhileIdle



getTimeBetweenEvictionRunsMillis
public synchronized long getTimeBetweenEvictionRunsMillis()(Code)
Returns the value of the BasicDataSource.timeBetweenEvictionRunsMillis property. the time (in miliseconds) between evictor runs
See Also:   BasicDataSource.timeBetweenEvictionRunsMillis



getUrl
public synchronized String getUrl()(Code)
Returns the JDBC connection BasicDataSource.url property. the BasicDataSource.url passed to the JDBC driver to establishconnections



getUsername
public synchronized String getUsername()(Code)
Returns the JDBC connection BasicDataSource.username property. the BasicDataSource.username passed to the JDBC driver to establishconnections



getValidationQuery
public synchronized String getValidationQuery()(Code)
Returns the validation query used to validate connections before returning them. the SQL validation query
See Also:   BasicDataSource.validationQuery



isAccessToUnderlyingConnectionAllowed
public synchronized boolean isAccessToUnderlyingConnectionAllowed()(Code)
Returns the value of the accessToUnderlyingConnectionAllowed property. true if access to the underlying connection is allowed, falseotherwise.



isPoolPreparedStatements
public synchronized boolean isPoolPreparedStatements()(Code)
Returns true if we are pooling statements. true if prepared statements are pooled



removeConnectionProperty
public void removeConnectionProperty(String name)(Code)
Remove a custom connection property.
Parameters:
  name - Name of the custom connection property to remove
See Also:   BasicDataSource.addConnectionProperty(String,String)



setAccessToUnderlyingConnectionAllowed
public synchronized void setAccessToUnderlyingConnectionAllowed(boolean allow)(Code)

Sets the value of the accessToUnderlyingConnectionAllowed property. It controls if the PoolGuard allows access to the underlying connection. (Default: false)

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:
  allow - Access to the underlying connection is granted when true.



setDefaultAutoCommit
public synchronized void setDefaultAutoCommit(boolean defaultAutoCommit)(Code)

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:
  defaultAutoCommit - default auto-commit value



setDefaultCatalog
public synchronized void setDefaultCatalog(String defaultCatalog)(Code)

Sets the default catalog.

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:
  defaultCatalog - the default catalog



setDefaultReadOnly
public synchronized void setDefaultReadOnly(boolean defaultReadOnly)(Code)

Sets defaultReadonly property.

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



setDefaultTransactionIsolation
public synchronized void setDefaultTransactionIsolation(int defaultTransactionIsolation)(Code)

Sets the default transaction isolation state for returned connections.

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:
  defaultTransactionIsolation - the default transaction isolationstate
See Also:   Connection.getTransactionIsolation



setDriverClassName
public synchronized void setDriverClassName(String driverClassName)(Code)

Sets the jdbc driver class name.

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:
  driverClassName - the class name of the jdbc driver



setInitialSize
public synchronized void setInitialSize(int initialSize)(Code)

Sets the initial size of the connection pool.

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:
  initialSize - the number of connections created when the poolis initialized



setLogAbandoned
public void setLogAbandoned(boolean logAbandoned)(Code)

Parameters:
  logAbandoned - new logAbandoned property value



setLogWriter
public void setLogWriter(PrintWriter logWriter) throws SQLException(Code)

Sets the log writer being used by this data source.

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


Parameters:
  logWriter - The new log writer
throws:
  SQLException - if a database access error occurs



setLoginTimeout
public void setLoginTimeout(int loginTimeout) throws SQLException(Code)

Set the login timeout (in seconds) for connecting to the database.

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


Parameters:
  loginTimeout - The new login timeout, or zero for no timeout
throws:
  SQLException - if a database access error occurs



setMaxActive
public synchronized void setMaxActive(int maxActive)(Code)
Sets the maximum number of active connections that can be allocated at the same time.
Parameters:
  maxActive - the new value for maxActive
See Also:   BasicDataSource.getMaxActive()



setMaxIdle
public synchronized void setMaxIdle(int maxIdle)(Code)
Sets the maximum number of connections that can remail idle in the pool.
See Also:   BasicDataSource.getMaxIdle()
Parameters:
  maxIdle - the new value for maxIdle



setMaxOpenPreparedStatements
public synchronized void setMaxOpenPreparedStatements(int maxOpenStatements)(Code)

Sets the value of the BasicDataSource.maxOpenPreparedStatements property.

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:
  maxOpenStatements - the new maximum number of prepared statements
See Also:   BasicDataSource.maxOpenPreparedStatements



setMaxWait
public synchronized void setMaxWait(long maxWait)(Code)
Sets the maxWait property.
Parameters:
  maxWait - the new value for maxWait
See Also:   BasicDataSource.getMaxWait()



setMinEvictableIdleTimeMillis
public synchronized void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis)(Code)
Sets the BasicDataSource.minEvictableIdleTimeMillis property.
Parameters:
  minEvictableIdleTimeMillis - the minimum amount of time an objectmay sit idle in the pool
See Also:   BasicDataSource.minEvictableIdleTimeMillis



setMinIdle
public synchronized void setMinIdle(int minIdle)(Code)
Sets the minimum number of idle connections in the pool.
Parameters:
  minIdle - the new value for minIdle
See Also:   GenericObjectPool.setMinIdle(int)



setNumTestsPerEvictionRun
public synchronized void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)(Code)
Sets the value of the BasicDataSource.numTestsPerEvictionRun property.
Parameters:
  numTestsPerEvictionRun - the new BasicDataSource.numTestsPerEvictionRun value
See Also:   BasicDataSource.numTestsPerEvictionRun



setPassword
public synchronized void setPassword(String password)(Code)

Sets the BasicDataSource.password .

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:
  password - new value for the password



setPoolPreparedStatements
public synchronized void setPoolPreparedStatements(boolean poolingStatements)(Code)

Sets whether to pool statements or not.

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:
  poolingStatements - pooling on or off



setRemoveAbandoned
public void setRemoveAbandoned(boolean removeAbandoned)(Code)

Parameters:
  removeAbandoned - new removeAbandoned property value



setRemoveAbandonedTimeout
public void setRemoveAbandonedTimeout(int removeAbandonedTimeout)(Code)

Parameters:
  removeAbandonedTimeout - new removeAbandonedTimeout value



setTestOnBorrow
public synchronized void setTestOnBorrow(boolean testOnBorrow)(Code)
Sets the BasicDataSource.testOnBorrow property. This property determines whether or not the pool will validate objects before they are borrowed from the pool. For a true value to have any effect, the validationQuery property must be set to a non-null string.
Parameters:
  testOnBorrow - new value for testOnBorrow property



setTestOnReturn
public synchronized void setTestOnReturn(boolean testOnReturn)(Code)
Sets the testOnReturn property. This property determines whether or not the pool will validate objects before they are returned to the pool. For a true value to have any effect, the validationQuery property must be set to a non-null string.
Parameters:
  testOnReturn - new value for testOnReturn property



setTestWhileIdle
public synchronized void setTestWhileIdle(boolean testWhileIdle)(Code)
Sets the testWhileIdle property. This property determines whether or not the idle object evictor will validate connections. For a true value to have any effect, the validationQuery property must be set to a non-null string.
Parameters:
  testWhileIdle - new value for testWhileIdle property



setTimeBetweenEvictionRunsMillis
public synchronized void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis)(Code)
Sets the BasicDataSource.timeBetweenEvictionRunsMillis property.
Parameters:
  timeBetweenEvictionRunsMillis - the new time between evictor runs
See Also:   BasicDataSource.timeBetweenEvictionRunsMillis



setUrl
public synchronized void setUrl(String url)(Code)

Sets the BasicDataSource.url .

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:
  url - the new value for the JDBC connection url



setUsername
public synchronized void setUsername(String username)(Code)

Sets the BasicDataSource.username .

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:
  username - the new value for the JDBC connection username



setValidationQuery
public synchronized void setValidationQuery(String validationQuery)(Code)

Sets the BasicDataSource.validationQuery .

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:
  validationQuery - the new value for the validation query



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.