Updated component versions; made PCF pool-setting consistent. JIRA: DBCP-412.
authorPhil Steitz <psteitz@apache.org>
Sat, 14 Feb 2015 00:04:17 +0000 (00:04 +0000)
committerPhil Steitz <psteitz@apache.org>
Sat, 14 Feb 2015 00:04:17 +0000 (00:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/dbcp/trunk@1659726 13f79535-47bb-0310-9956-ffa450edef68

doc/BasicDataSourceExample.java
doc/PoolingDataSourceExample.java
doc/PoolingDriverExample.java

index 7fe2f43..cb700b7 100644 (file)
@@ -39,18 +39,17 @@ import org.apache.commons.dbcp2.BasicDataSource;
 
 //
 // To compile this example, you'll want:
-//  * commons-pool-1.5.6.jar
-//  * commons-dbcp-1.3.jar (JDK 1.4-1.5) or commons-dbcp-1.4 (JDK 1.6+)
-//  * j2ee.jar (for the javax.sql classes)
+//  * commons-pool-2.3.jar
+//  * commons-dbcp-2.1.jar 
 // in your classpath.
 //
 // To run this example, you'll want:
-//  * commons-pool-1.5.6.jar
-//  * commons-dbcp-1.3.jar (JDK 1.4-1.5) or commons-dbcp-1.4 (JDK 1.6+)
-//  * j2ee.jar (for the javax.sql classes)
-//  * the classes for your (underlying) JDBC driver
+//  * commons-pool-2.3.jar
+//  * commons-dbcp-2.1.jar 
+//  * commons-logging-1.2.jar
 // in your classpath.
 //
+//
 // Invoke the class using two arguments:
 //  * the connect string for your underlying JDBC driver
 //  * the query you'd like to execute
@@ -60,7 +59,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
 //
 // For example:
 //  java -Djdbc.drivers=oracle.jdbc.driver.OracleDriver \
-//       -classpath commons-pool-1.5.6.jar:commons-dbcp-1.4.jar:j2ee.jar:oracle-jdbc.jar:. \
+//       -classpath commons-pool-2.3.jar:commons-dbcp-2.1.jar:oracle-jdbc.jar:commons-logging-1.2.jar. \
 //       PoolingDataSourceExample
 //       "jdbc:oracle:thin:scott/tiger@myhost:1521:mysid"
 //       "SELECT * FROM DUAL"
index 71a3807..2a12c74 100644 (file)
@@ -47,14 +47,14 @@ import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
 
 //
 // To compile this example, you'll want:
-//  * commons-pool2-2.2.jar
-//  * commons-dbcp2-2.0.jar
+//  * commons-pool2-2.3.jar
+//  * commons-dbcp2-2.1.jar
 // in your classpath.
 //
 // To run this example, you'll want:
-//  * commons-pool2-2.2.jar
-//  * commons-dbcp2-2.0.jar
-//  * commons-logging-1.1.3.jar
+//  * commons-pool2-2.3.jar
+//  * commons-dbcp2-2.1.jar
+//  * commons-logging-1.2.jar
 //  * the classes for your (underlying) JDBC driver
 // in your classpath.
 //
@@ -67,7 +67,7 @@ import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
 //
 // For example:
 //  java -Djdbc.drivers=org.h2.Driver \
-//       -classpath commons-pool2-2.2.jar:commons-dbcp2-2.0.jar:commons-logging-1.1.3.jar:h2-1.3.152.jar:. \
+//       -classpath commons-pool2-2.3.jar:commons-dbcp2-2.1.jar:commons-logging-1.2.jar:h2-1.3.152.jar:. \
 //       PoolingDataSourceExample \
 //       "jdbc:h2:~/test" \
 //       "SELECT 1"
index 597e92c..4d2dc0c 100644 (file)
@@ -39,17 +39,15 @@ import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
 // Here's a simple example of how to use the PoolingDriver.
 //
 
-//
 // To compile this example, you'll want:
-//  * commons-pool-1.5.6.jar
-//  * commons-dbcp-1.3.jar (JDK 1.4-1.5) or commons-dbcp-1.4 (JDK 1.6+)
+//  * commons-pool-2.3.jar
+//  * commons-dbcp-2.1.jar 
 // in your classpath.
 //
 // To run this example, you'll want:
-//  * commons-collections.jar
-//  * commons-pool-1.5.6.jar
-//  * commons-dbcp-1.3.jar (JDK 1.4-1.5) or commons-dbcp-1.4 (JDK 1.6+)
-//  * the classes for your (underlying) JDBC driver
+//  * commons-pool-2.3.jar
+//  * commons-dbcp-2.1.jar 
+//  * commons-logging-1.2.jar
 // in your classpath.
 //
 // Invoke the class using two arguments:
@@ -61,7 +59,7 @@ import org.apache.commons.dbcp2.DriverManagerConnectionFactory;
 //
 // For example:
 //  java -Djdbc.drivers=oracle.jdbc.driver.OracleDriver \
-//       -classpath commons-pool-1.5.6.jar:commons-dbcp-1.4.jar:oracle-jdbc.jar:. \
+//       -classpath commons-pool-2.3.jar:commons-dbcp-2.1.jar:oracle-jdbc.jar:commons-logging-1.2.jar. \
 //       PoolingDriverExample \
 //       "jdbc:oracle:thin:scott/tiger@myhost:1521:mysid" \
 //       "SELECT * FROM DUAL"
@@ -174,6 +172,9 @@ public class PoolingDriverExample {
         //
         ObjectPool<PoolableConnection> connectionPool =
             new GenericObjectPool<>(poolableConnectionFactory);
+        
+        // Set the factory's pool property to the owning pool
+        poolableConnectionFactory.setPool(connectionPool);
 
         //
         // Finally, we create the PoolingDriver itself...