You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Eric Pugh <ep...@upstate.com> on 2002/04/30 16:19:36 UTC

Question about DBCP

Hi all,

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.

Eric


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by Eric Pugh <ep...@upstate.com>.
Sorry, hit send button too quick.  I am attaching my JUnit test that I am
working with.

Thanks,
Eric

-----Original Message-----
From: Eric Pugh [mailto:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 10:20 AM
To: 'Jakarta Commons Developers List'
Subject: Question about DBCP


Hi all,

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.

Eric


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>

RE: Question about DBCP

Posted by Anjan Bacchu <an...@bluewireless.com>.
Hi Eric,

	The way I specify a Driver is by having another XML Config file(cooked up
my own schema)
which lists the name of the JOCL file(pool) and the respective driver. Then,
before
my application initializes, I read this XML Config file and load the classes
by
"class.forName()" explicitly for each Driver(pool).

	DBCP could allow for having the Driver described in the JOCL file(which is
the
predecessor to Digester) for each pool. It need not have to do anything with
the driver
but could allow the user(application) to access the JOCL file's driver
property.
Does it make sense ? This would prevent me from having to come up with
another file
which just lists the pool name and its Driver.

Best Regards,
ANJAN. B

-----Original Message-----
From: Eric Pugh [mailto:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 10:31 AM
To: 'Jakarta Commons Developers List'
Subject: RE: Question about DBCP


I see, when the docs are referring to the property jdbc.drivers, that is
something passed to the JVM that makes it load them implicitly for you!

However, I am planning on calling this from another application, DbForms.
Therefore, I need the driver to be specified in the JOCL file..  Is there an
attriubte specified that I can use to provide that, or do I have to work via
passing it in via the property.

Eric

-----Original Message-----
From: Eric Pugh [mailto:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 1:19 PM
To: 'Jakarta Commons Developers List'
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!

Lastly, is there any way to have a monitor on the pool size?

Eric

-----Original Message-----
From: Anjan [mailto:anjan@bluewireless.com]
Sent: Tuesday, April 30, 2002 12:42 PM
To: Jakarta Commons Developers List
Subject: RE: Question about DBCP


Hi Eric!,

	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:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 7:20 AM
To: 'Jakarta Commons Developers List'
Subject: Question about DBCP


Hi all,

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.

Eric


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by Eric Pugh <ep...@upstate.com>.
I see, when the docs are referring to the property jdbc.drivers, that is
something passed to the JVM that makes it load them implicitly for you!

However, I am planning on calling this from another application, DbForms.
Therefore, I need the driver to be specified in the JOCL file..  Is there an
attriubte specified that I can use to provide that, or do I have to work via
passing it in via the property.

Eric

-----Original Message-----
From: Eric Pugh [mailto:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 1:19 PM
To: 'Jakarta Commons Developers List'
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!

Lastly, is there any way to have a monitor on the pool size?

Eric

-----Original Message-----
From: Anjan [mailto:anjan@bluewireless.com]
Sent: Tuesday, April 30, 2002 12:42 PM
To: Jakarta Commons Developers List
Subject: RE: Question about DBCP


Hi Eric!,

	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:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 7:20 AM
To: 'Jakarta Commons Developers List'
Subject: Question about DBCP


Hi all,

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.

Eric


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 30 Apr 2002, Eric Pugh wrote:

> Date: Tue, 30 Apr 2002 16:54:21 -0400
> From: Eric Pugh <ep...@upstate.com>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: 'Jakarta Commons Developers List' <co...@jakarta.apache.org>
> Subject: RE: Question about DBCP
>
> Well,
>
> I wanted to post to the list what I learned!  Firstly, thanks to Craig for
> his quick patch on exposing the number of active and idle connections for
> BasicDataSource.
>
> I am able to successfully pool connections for use by DbForms.  That is
> wonderful!  I am currently running on MSSQLServer 2000 and use the MS
> JDBCODBC driver.  I ended up using the BasicDataSource because it was easy.
>
> Some things I have noticed/have questions:
>
> 1) If I don't provide a maxActive, then when I go for the first connection,
> nothing happends.
>

Need to look at that one.  According to the docs, setting maxActive to
zero (or not setting it at all, because this is the default) is supposed
to mean no limit.

> 2) What exactly does the idle mean?  At one point I had 5 connections
> running according to the database server, but according to the the numIdle,
> numActive, I only had 2 active, 0 idle..  Are there some extra connections
> as overhead?  I know I wasn't using any of them for other processes.
>

DBCP also knows how to destroy idle connections if there are more than
maxWait of them.  Could this be happening to you?

> 3) What is the difference between the BasicDataSource and the
> BasicDataSourceFactory?  Is BasicDataSource what I should be using to pool
> my db connections for a web app?
>

BasicDataSource is an implementation of javax.sql.DataSource (although not
the only one that could be built on top of the pool and dbcp packages).
It is what you'd use in a stand-alone application where you didn't want to
compose a connection pool yourself.

BasicDataSourceFactory is a JNDI ObjectFactory implementation that can be
registered in a JNDI environment, and use it to create a BasicDataSource
implementation the first time it is retrieved.  This is how Tomcat
actually creates the data source instance.

> 4) The code for the Tomcat 4.0 DBCPPoolFactory (sp?) in  CVS seems to have
> been replaced with the text of an Ant Build file.  (I got that browsing via
> the web cvs).
>

Still looks ok to me in the head branch (although this is the code I
migrated into DBCP to create the BasicDataSourceFactory class.

> How I configured my DataSource:
> try{
>	if (dataSource == null){
>		dataSource = new BasicDataSource();
>		dataSource.setDriverClassName(conClass);
>		dataSource.setUrl(name);
>		dataSource.setPassword(password);
>		dataSource.setUsername(username);
>		dataSource.setValidationQuery(null);
>		dataSource.setMaxActive(20);
>		dataSource.setMaxIdle(5);
>		dataSource.setMaxWait(-1);
>	}
>	logCat.debug("Current Connections: active:" + dataSource.getNumActive()
>          + ", idle:" + dataSource.getNumIdle());
> 	return dataSource.getConnection();
> }
> catch (Exception e){
> 	logCat.error(e);
> 	e.printStackTrace();
> 	return null;
> }
>
>
> Thank you very much for the help,
>
> Eric
>

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by Eric Pugh <ep...@upstate.com>.
Well,

I wanted to post to the list what I learned!  Firstly, thanks to Craig for
his quick patch on exposing the number of active and idle connections for
BasicDataSource.

I am able to successfully pool connections for use by DbForms.  That is
wonderful!  I am currently running on MSSQLServer 2000 and use the MS
JDBCODBC driver.  I ended up using the BasicDataSource because it was easy.

Some things I have noticed/have questions:

1) If I don't provide a maxActive, then when I go for the first connection,
nothing happends.

2) What exactly does the idle mean?  At one point I had 5 connections
running according to the database server, but according to the the numIdle,
numActive, I only had 2 active, 0 idle..  Are there some extra connections
as overhead?  I know I wasn't using any of them for other processes.

3) What is the difference between the BasicDataSource and the
BasicDataSourceFactory?  Is BasicDataSource what I should be using to pool
my db connections for a web app?

4) The code for the Tomcat 4.0 DBCPPoolFactory (sp?) in  CVS seems to have
been replaced with the text of an Ant Build file.  (I got that browsing via
the web cvs).

How I configured my DataSource:
try{
					if (dataSource == null){
						dataSource = new BasicDataSource();
						dataSource.setDriverClassName(conClass);
						dataSource.setUrl(name);
						dataSource.setPassword(password);
						dataSource.setUsername(username);
						dataSource.setValidationQuery(null);
						dataSource.setMaxActive(20);
						dataSource.setMaxIdle(5);
						dataSource.setMaxWait(-1);
					}
					logCat.debug("Current Connections: active:" + dataSource.getNumActive()
+", idle:" + dataSource.getNumIdle());
					return dataSource.getConnection();
				}
				catch (Exception e){
					logCat.error(e);
					e.printStackTrace();
					return null;

				}


Thank you very much for the help,

Eric

-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Tuesday, April 30, 2002 2:07 PM
To: Jakarta Commons Developers List
Subject: RE: Question about DBCP




On Tue, 30 Apr 2002, Eric Pugh wrote:

> Date: Tue, 30 Apr 2002 13:18:59 -0400
> From: Eric Pugh <ep...@upstate.com>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: 'Jakarta Commons Developers List' <co...@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.

> Eric

Craig


>
> -----Original Message-----
> From: Anjan [mailto:anjan@bluewireless.com]
> Sent: Tuesday, April 30, 2002 12:42 PM
> To: Jakarta Commons Developers List
> Subject: RE: Question about DBCP
>
>
> Hi Eric!,
>
> 	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:epugh@upstate.com]
> Sent: Tuesday, April 30, 2002 7:20 AM
> To: 'Jakarta Commons Developers List'
> Subject: Question about DBCP
>
>
> Hi all,
>
> 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.
>
> Eric
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 30 Apr 2002, Eric Pugh wrote:

> Date: Tue, 30 Apr 2002 13:18:59 -0400
> From: Eric Pugh <ep...@upstate.com>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: 'Jakarta Commons Developers List' <co...@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.

> Eric

Craig


>
> -----Original Message-----
> From: Anjan [mailto:anjan@bluewireless.com]
> Sent: Tuesday, April 30, 2002 12:42 PM
> To: Jakarta Commons Developers List
> Subject: RE: Question about DBCP
>
>
> Hi Eric!,
>
> 	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:epugh@upstate.com]
> Sent: Tuesday, April 30, 2002 7:20 AM
> To: 'Jakarta Commons Developers List'
> Subject: Question about DBCP
>
>
> Hi all,
>
> 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.
>
> Eric
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by Eric Pugh <ep...@upstate.com>.
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!

Lastly, is there any way to have a monitor on the pool size?

Eric

-----Original Message-----
From: Anjan [mailto:anjan@bluewireless.com]
Sent: Tuesday, April 30, 2002 12:42 PM
To: Jakarta Commons Developers List
Subject: RE: Question about DBCP


Hi Eric!,

	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:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 7:20 AM
To: 'Jakarta Commons Developers List'
Subject: Question about DBCP


Hi all,

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.

Eric


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Question about DBCP

Posted by Anjan <an...@bluewireless.com>.
Hi Eric!,

	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:epugh@upstate.com]
Sent: Tuesday, April 30, 2002 7:20 AM
To: 'Jakarta Commons Developers List'
Subject: Question about DBCP


Hi all,

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.

Eric


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>