Re: JDBC Connection Pooling Not Quite Right?

2002-11-09 Thread Rick Mann
sql, query ... just to make the filter happy.

on 11/8/02 2:30 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED]
wrote:

 You are missing something, I am afraid. To quite Sun's Javadoc for the
 PooledConnection class

Thank you so much for the quick reply.

Now I understand why the implementation of pooled connections seemed so lame
(why on earth did JDBC client code need to get a different kind of
connection?).

Strikes me that it's just as ridiculous that I have to implement the pooling
scheme. It would have made more sense to provide a reasonable pooling scheme
and allowed me to add my own, if I so desired.

In any event, thank you. Now I know how to fix the problem!

 The Java list - [EMAIL PROTECTED] - would probaby be more appropriate
 than the general list, but otherwise this is the right place.

Perhaps that should be mentioned on the Connector/J pages...I had no idea
such a list existed. Thanks!

-- 
Rick


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: JDBC Connection Pooling Not Quite Right?

2002-11-09 Thread Mark Matthews
Rick Mann wrote:


sql, query ... just to make the filter happy.

on 11/8/02 2:30 AM, [EMAIL PROTECTED] at [EMAIL PROTECTED]
wrote:


You are missing something, I am afraid. To quite Sun's Javadoc for the
PooledConnection class


Thank you so much for the quick reply.

Now I understand why the implementation of pooled connections seemed 
so lame
(why on earth did JDBC client code need to get a different kind of
connection?).

Strikes me that it's just as ridiculous that I have to implement the 
pooling
scheme. It would have made more sense to provide a reasonable pooling 
scheme
and allowed me to add my own, if I so desired.

Not in Sun's eyes. They figure (rightly or wrongly) that no one runs 
server-side Java outside of some application server. So they don't spend 
time specifying a 'standard' connection pool, because that's 'vendor' 
specific...instead they specify a contract between a JDBC driver and an 
application server to provide connection pooling.

On the other hand, you don't need to re-invent the wheel either. There 
is a lot of open source connection pooling code out there. The one I'm 
currently recommending (as it sees the most current development) is DBCP 
from the Apache Jakarta Commons project:

http://jakarta.apache.org/commons/dbcp.html


In any event, thank you. Now I know how to fix the problem!


The Java list - [EMAIL PROTECTED] - would probaby be more appropriate
than the general list, but otherwise this is the right place.


Perhaps that should be mentioned on the Connector/J pages...I had no idea
such a list existed. Thanks!


I'll forward the request to our web team. It is mentioned at the bottom 
of the README for the driver, however :)

	-Mark
--
For technical support contracts, visit https://order.mysql.com/?ref=mmma

__  ___ ___   __
   /  |/  /_ __/ __/ __ \/ /  Mark Matthews [EMAIL PROTECTED]
  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
 /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
___/ www.mysql.com


-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



JDBC Connection Pooling Not Quite Right?

2002-11-08 Thread Rick Mann
Hi. I hope this is the right place to discuss this, now that the drivers are
part of the official MySQL stuff. If not, please let me know where I should
post this. Thanks.

I've been using the 2.0.14 version of the drivers, and just recently
switched to using the pooled connections supplied by JDBC 2.0. What I
noticed was that I'm still creating many connections. For example, I did an
operation in my web app that makes about 30 connections, and the number of
connections opened in MySQL (which I had just recently restarted) jumped
from 200 to 231.

So, I went digging through the JDBC code, and found that every time the
PooldedDataSource returns a new PooledConnection, with a new physical
Connection obtained from the non-pooled DataSource. No where can I find the
actual pool in which the pooledConnections are kept.

Am I completely missing something, and there some other thing I need to do,
or is this how it's supposed to be, or (most likely, I think), is there a
serious flaw in the MySQL JDBC drivers?

TIA,

-- 
Rick


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: JDBC Connection Pooling Not Quite Right?

2002-11-08 Thread Alec . Cawley

Hi, Rick,

 Hi. I hope this is the right place to discuss this, now that the drivers
are
 part of the official MySQL stuff. If not, please let me know where I
should
 post this. Thanks.

The Java list - [EMAIL PROTECTED] - would probaby be more appropriate
than the general list, but otherwise this is the right place.

 I've been using the 2.0.14 version of the drivers, and just recently
 switched to using the pooled connections supplied by JDBC 2.0. What I
 noticed was that I'm still creating many connections. For example, I did
an
 operation in my web app that makes about 30 connections, and the number
of
 connections opened in MySQL (which I had just recently restarted) jumped
 from 200 to 231.

 So, I went digging through the JDBC code, and found that every time the
 PooldedDataSource returns a new PooledConnection, with a new physical
 Connection obtained from the non-pooled DataSource. No where can I find
the
 actual pool in which the pooledConnections are kept.

 Am I completely missing something, and there some other thing I need to
do,
 or is this how it's supposed to be, or (most likely, I think), is there a
 serious flaw in the MySQL JDBC drivers?

You are missing something, I am afraid. To quite Sun's Javadoc for the
PooledConnection class

An object that provides hooks for connection pool management.
A PooledConnection object represents a physical connection to
a data source. The connection can be recycled rather than being
closed when an application is finished with it, thus reducing
the number of connections that need to be made.

An application programmer does not use the PooledConnection
interface directly; rather, it is used by a middle tier
infrastructure that manages the pooling of connections.

You need to obtain or write a Pool Manager. Application code then
calls PoolManager.getConnection () instead of creating a new connection,
but otherwise runs unchanged. When the application calls Connection.close(,
the PoolManager is informed and can take appropriate recycling
action (releasing any resultsets, adding to a pool of available
connections, deleting long-unused connections before MySQL gets
bored of them ).

  Alec Cawley




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php