|Steve Cohen||Apr 29, 2002 9:29 pm||.txt|
|Brekke, Jeff||Apr 30, 2002 7:03 am|
|Eric Pugh||Apr 30, 2002 7:19 am|
|Eric Pugh||Apr 30, 2002 7:25 am||.java|
|Anjan||Apr 30, 2002 9:41 am|
|Eric Pugh||Apr 30, 2002 10:18 am|
|Eric Pugh||Apr 30, 2002 10:30 am|
|Craig R. McClanahan||Apr 30, 2002 11:06 am|
|Anjan Bacchu||Apr 30, 2002 11:40 am|
|Eric Pugh||Apr 30, 2002 1:53 pm|
|Craig R. McClanahan||Apr 30, 2002 2:19 pm|
|Subject:||RE: Question about DBCP|
|From:||Craig R. McClanahan (crai...@apache.org)|
|Date:||Apr 30, 2002 11:06:12 am|
On Tue, 30 Apr 2002, Eric Pugh wrote:
Date: Tue, 30 Apr 2002 13:18:59 -0400 From: Eric Pugh <epu...@upstate.com> Reply-To: Jakarta Commons Developers List <comm...@jakarta.apache.org> To: 'Jakarta Commons Developers List' <comm...@jakarta.apache.org> Subject: RE: Question about DBCP
Thanks for the info,
I guess the whole JOCL thing was scaring me.. What is JOCL? It appears to be some sort of weird config format only used by DBCP? I guess I didn't want to try and figure it all out (lazy me!)... Also, DbForms uses the Digester to parse an XML file, and DBForms tanks if I add in Xalan/Xerces with Digester in the classpath.. I was hoping to keep things simple, but I will look at the JOCLPoolingDriverExample.
Did you basically just use the example as your code? I'm trying to solve a problem without customizing/writing much at all!
A different approach would be to use a "pre packaged" data source implementation like org.apache.commons.dbcp.BasicDataSource. This is what Tomcat 4.1 is going to use as the default data source implementation (accessbile via JNDI), but it also works fine in other environments -- just configure it with JavaBeans property setters in whatever manner you'd like.
Lastly, is there any way to have a monitor on the pool size?
The underlying pool implementations have numActive() and numIdle() methods -- this would need to be rippled up to be visible through the DBCP implementation -- I just checked in an update to BasicDataSource for this.
-----Original Message----- From: Anjan [mailto:anj...@bluewireless.com] Sent: Tuesday, April 30, 2002 12:42 PM To: Jakarta Commons Developers List Subject: RE: Question about DBCP
I was using poolman in our NON open-source product but eventually moved to DBCP -- it works fine for me.
Did you look at JOCLPoolingDriverExample.java in the doc directory ? This gives a sample of how the DriverManager uses the "jdbc.drivers" property.
When DriverManager loads, it looks for the property jdbc.drivers and then loads all the drivers specified in this property(Be sure to separate the drivers in this property using COLONs and NOT SEMI-COLONs. You don't have to use Class.forName() on it since JDBC(1.2 JDK and later) uses this property to load all the drivers and initialize the drivers(actually the drivers register with the DriverManager when they are loaded).
If you want to know more, you can look into the source of DriverManager in the JDK source. You will know that pooling is working by the speed with which the connections are obtained when you use DriverManager.getConnection(url);
Best Regards, ANJAN. B
-----Original Message----- From: Eric Pugh [mailto:epu...@upstate.com] Sent: Tuesday, April 30, 2002 7:20 AM To: 'Jakarta Commons Developers List' Subject: Question about DBCP
Can anyone provide pointers to open source sites using DBCP? I am trying to get DBCP to work with DbForms (www.dbforms.org). DbForms currently uses Poolman as it's suggested pool for JDBC connections, but it badly needs something newer and easier to set up!
I have managed to tweak the class ManualPoolingDataSourceExample to work with MSSql Server. However, what is confusing to me is how in the example my jdbc driver is passed in? I see it goes in from the commandline as -Djdbc.drivers=oracle.jdbc.driver.OracleDriver, but I never see how it get's used. In addition, when i hardcoded my driver, I couldn't get it to work until I added a Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver") at the top of the code in my copy of ManualPoolingDataSourceExample.
Can someone give me some pointers on how the -Djdbc.drivers value actually get's registered with the DriverManager?
Also, how can I verify that I am actually pooling connections, versus creating a new one over and over?
I have attached my copy of ManualPoolingDataSourceExample that I have renamed to ManualPoolingDataSourceTest, and am using under JUnit to test.