Java Doc for DriverAdapterCPDS.java in  » Database-JDBC-Connection-Pool » Connection-Pool-DBCP » org » apache » commons » dbcp » cpdsadapter » 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.cpdsadapter 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.dbcp.cpdsadapter.DriverAdapterCPDS

DriverAdapterCPDS
public class DriverAdapterCPDS implements ConnectionPoolDataSource,Referenceable,Serializable,ObjectFactory(Code)

An adapter for jdbc drivers that do not include an implementation of javax.sql.ConnectionPoolDataSource , but still include a java.sql.DriverManager implementation. ConnectionPoolDataSources are not used within general applications. They are used by DataSource implementations that pool Connections, such as org.apache.commons.dbcp.datasources.SharedPoolDataSource . A J2EE container will normally provide some method of initializing the ConnectionPoolDataSource whose attributes are presented as bean getters/setters and then deploying it via JNDI. It is then available as a source of physical connections to the database, when the pooling DataSource needs to create a new physical connection.

Although normally used within a JNDI environment, the DriverAdapterCPDS can be instantiated and initialized as any bean and then attached directly to a pooling DataSource. Jdbc2PoolDataSource can use the ConnectionPoolDataSource with or without the use of JNDI.

The DriverAdapterCPDS also provides PreparedStatement pooling which is not generally available in jbdc2 ConnectionPoolDataSource implementation, but is addressed within the jdbc3 specification. The PreparedStatement pool in DriverAdapterCPDS has been in the dbcp package for some time, but it has not undergone extensive testing in the configuration used here. It should be considered experimental and can be toggled with the poolPreparedStatements attribute.

The package documentation contains an example using catalina and JNDI. The datasources package documentation shows how to use DriverAdapterCPDS as a source for Jdbc2PoolDataSource without the use of JNDI.


author:
   John D. McNally
version:
   $Revision: 500687 $ $Date: 2007-01-27 16:33:47 -0700 (Sat, 27 Jan 2007) $



Constructor Summary
public  DriverAdapterCPDS()
    

Method Summary
public  StringgetDescription()
     Get the value of description.
public  StringgetDriver()
     Get the driver classname.
public  PrintWritergetLogWriter()
     Get the log writer for this data source.
public  intgetLoginTimeout()
     Gets the maximum time in seconds that this data source can wait while attempting to connect to a database.
public  intgetMaxActive()
     The maximum number of active statements that can be allocated from this pool at the same time, or non-positive for no limit.
public  intgetMaxIdle()
     The maximum number of statements that can remain idle in the pool, without extra ones being released, or negative for no limit.
public  intgetMaxPreparedStatements()
     Returns the maximun number of prepared statements.
public  intgetMinEvictableIdleTimeMillis()
     Returns the minimum amount of time a statement may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any).
public  intgetNumTestsPerEvictionRun()
     Returns the number of statements to examine during each run of the idle object evictor thread (if any).
public  ObjectgetObjectInstance(Object refObj, Name name, Context context, Hashtable env)
    
public  StringgetPassword()
     Get the value of password for the default user.
public  PooledConnectiongetPooledConnection()
     Attempt to establish a database connection using the default user and password.
public  PooledConnectiongetPooledConnection(String username, String password)
     Attempt to establish a database connection.
public  ReferencegetReference()
     Referenceable implementation.
public  intgetTimeBetweenEvictionRunsMillis()
     Returns the number of milliseconds to sleep between runs of the idle object evictor thread.
public  StringgetUrl()
     Get the value of url used to locate the database for this datasource.
public  StringgetUser()
     Get the value of default user (login or username).
public  booleanisPoolPreparedStatements()
    
public  voidsetDescription(String v)
     Set the value of description.
public  voidsetDriver(String v)
     Set the driver classname.
public  voidsetLogWriter(java.io.PrintWriter out)
     Set the log writer for this data source.
public  voidsetLoginTimeout(int seconds)
     Sets the maximum time in seconds that this data source will wait while attempting to connect to a database.
public  voidsetMaxActive(int maxActive)
     The maximum number of active statements that can be allocated from this pool at the same time, or non-positive for no limit.
public  voidsetMaxIdle(int maxIdle)
     The maximum number of statements that can remain idle in the pool, without extra ones being released, or negative for no limit.
public  voidsetMaxPreparedStatements(int maxPreparedStatements)
     Sets the maximum number of prepared statements.
public  voidsetMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)
     Sets the minimum amount of time a statement may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any).
public  voidsetNumTestsPerEvictionRun(int numTestsPerEvictionRun)
     Sets the number of statements to examine during each run of the idle object evictor thread (if any).

When a negative value is supplied, ceil({*link #numIdle})/abs({*link #getNumTestsPerEvictionRun}) tests will be run.

public  voidsetPassword(String v)
     Set the value of password for the default user.
public  voidsetPoolPreparedStatements(boolean v)
    
public  voidsetTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)
     Sets the number of milliseconds to sleep between runs of the idle object evictor thread.
public  voidsetUrl(String v)
     Set the value of url used to locate the database for this datasource.
public  voidsetUser(String v)
     Set the value of default user (login or username).


Constructor Detail
DriverAdapterCPDS
public DriverAdapterCPDS()(Code)
Default no-arg constructor for Serialization




Method Detail
getDescription
public String getDescription()(Code)
Get the value of description. This property is here for use by the code which will deploy this datasource. It is not used internally. value of description.



getDriver
public String getDriver()(Code)
Get the driver classname. value of driver.



getLogWriter
public PrintWriter getLogWriter()(Code)
Get the log writer for this data source. NOT USED.



getLoginTimeout
public int getLoginTimeout()(Code)
Gets the maximum time in seconds that this data source can wait while attempting to connect to a database. NOT USED.



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



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



getMaxPreparedStatements
public int getMaxPreparedStatements()(Code)
Returns the maximun number of prepared statements. maxPrepartedStatements value
since:
   1.2.2



getMinEvictableIdleTimeMillis
public int getMinEvictableIdleTimeMillis()(Code)
Returns the minimum amount of time a statement may sit idle in the pool before it is eligible for eviction by the idle object evictor (if any). see #setMinEvictableIdleTimeMillis see #setTimeBetweenEvictionRunsMillis



getNumTestsPerEvictionRun
public int getNumTestsPerEvictionRun()(Code)
Returns the number of statements to examine during each run of the idle object evictor thread (if any). see #setNumTestsPerEvictionRun see #setTimeBetweenEvictionRunsMillis



getObjectInstance
public Object getObjectInstance(Object refObj, Name name, Context context, Hashtable env) throws Exception(Code)
implements ObjectFactory to create an instance of this class



getPassword
public String getPassword()(Code)
Get the value of password for the default user. value of password.



getPooledConnection
public PooledConnection getPooledConnection() throws SQLException(Code)
Attempt to establish a database connection using the default user and password.



getPooledConnection
public PooledConnection getPooledConnection(String username, String password) throws SQLException(Code)
Attempt to establish a database connection.



getReference
public Reference getReference() throws NamingException(Code)
Referenceable implementation.



getTimeBetweenEvictionRunsMillis
public int getTimeBetweenEvictionRunsMillis()(Code)
Returns 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. see #setTimeBetweenEvictionRunsMillis



getUrl
public String getUrl()(Code)
Get the value of url used to locate the database for this datasource. value of url.



getUser
public String getUser()(Code)
Get the value of default user (login or username). value of user.



isPoolPreparedStatements
public boolean isPoolPreparedStatements()(Code)
Flag to toggle the pooling of PreparedStatements value of poolPreparedStatements.



setDescription
public void setDescription(String v)(Code)
Set the value of description. This property is here for use by the code which will deploy this datasource. It is not used internally.
Parameters:
  v - Value to assign to description.



setDriver
public void setDriver(String v) throws ClassNotFoundException(Code)
Set the driver classname. Setting the driver classname cause the driver to be registered with the DriverManager.
Parameters:
  v - Value to assign to driver.



setLogWriter
public void setLogWriter(java.io.PrintWriter out)(Code)
Set the log writer for this data source. NOT USED.



setLoginTimeout
public void setLoginTimeout(int seconds)(Code)
Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. NOT USED.



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



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



setMaxPreparedStatements
public void setMaxPreparedStatements(int maxPreparedStatements)(Code)
Sets the maximum number of prepared statements.
Parameters:
  maxPreparedStatements - the new maximum number of prepared statements
since:
   1.2.2



setMinEvictableIdleTimeMillis
public void setMinEvictableIdleTimeMillis(int minEvictableIdleTimeMillis)(Code)
Sets the minimum amount of time a statement may sit idle in the pool before it is eligable for eviction by the idle object evictor (if any). When non-positive, no objects will be evicted from the pool due to idle time alone. see #getMinEvictableIdleTimeMillis see #setTimeBetweenEvictionRunsMillis



setNumTestsPerEvictionRun
public void setNumTestsPerEvictionRun(int numTestsPerEvictionRun)(Code)
Sets the number of statements to examine during each run of the idle object evictor thread (if any).

When a negative value is supplied, ceil({*link #numIdle})/abs({*link #getNumTestsPerEvictionRun}) tests will be run. I.e., when the value is -n, roughly one nth of the idle objects will be tested per run. see #getNumTestsPerEvictionRun see #setTimeBetweenEvictionRunsMillis




setPassword
public void setPassword(String v)(Code)
Set the value of password for the default user.
Parameters:
  v - Value to assign to password.



setPoolPreparedStatements
public void setPoolPreparedStatements(boolean v)(Code)
Flag to toggle the pooling of PreparedStatements
Parameters:
  v - true to pool statements.



setTimeBetweenEvictionRunsMillis
public void setTimeBetweenEvictionRunsMillis(int timeBetweenEvictionRunsMillis)(Code)
Sets 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. see #getTimeBetweenEvictionRunsMillis



setUrl
public void setUrl(String v)(Code)
Set the value of url used to locate the database for this datasource.
Parameters:
  v - Value to assign to url.



setUser
public void setUser(String v)(Code)
Set the value of default user (login or username).
Parameters:
  v - Value to assign to user.



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.