Re: OT: db pool problems - jdbc connection count?

2003-10-30 Thread Oscar Carrillo
How about just watching the processes for postgresql while you access the 
site?:

ps auxw | grep postgres

Oscar

On Thu, 30 Oct 2003, john-paul delaney wrote:

 Hello List...
 
 Sorry if this is off-topic.  Although I think I'm following the
 jndi-resources-howto fairly well, I find I'm running out of connections
 and I have to restart tomcat to free them up.  I'd like to know how many
 jdbc connections are in use at any given time with the intention of
 finding the offending servlet(s).  I'm using postgreSQL.  I've googled
 and looked at the postgres user lists but not found an example on how to
 detect the current number of connections in use.  Can anyone help?
 
 tomcat 4.1.24
 postgresql 7.3.3
 pg73jdbc3.jar
 commons-pool 1.0.1
 
 I believe I'be been pretty thorough in closing down resultsets, preparedstatements 
 and connections after use, and use the removeAbandoned parameter in the DataSource 
 Resource section of server.xml.
 
 Any leads are much appreciated.
 
 thanks
 /j-p.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread Shapira, Yoav

Howdy,
You can write a bit of code to do this:

- Create an InitialContext
- Get the java:comp/env context
- Lookup your connection pool by JNDI name
- Cast your connection pool to the appropriate type as specified in your
server.xml

Then you can call the implementation-specific method, e.g.
getNumActive() / getNumIdle() for
org.apache.commons.dbcp.BasicDataSource, to look at values.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Oscar Carrillo [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 30, 2003 1:18 PM
To: Tomcat Users List
Subject: Re: OT: db pool problems - jdbc connection count?

How about just watching the processes for postgresql while you access
the
site?:

ps auxw | grep postgres

Oscar

On Thu, 30 Oct 2003, john-paul delaney wrote:

 Hello List...

 Sorry if this is off-topic.  Although I think I'm following the
 jndi-resources-howto fairly well, I find I'm running out of
connections
 and I have to restart tomcat to free them up.  I'd like to know how
many
 jdbc connections are in use at any given time with the intention of
 finding the offending servlet(s).  I'm using postgreSQL.  I've
googled
 and looked at the postgres user lists but not found an example on how
to
 detect the current number of connections in use.  Can anyone help?

 tomcat 4.1.24
 postgresql 7.3.3
 pg73jdbc3.jar
 commons-pool 1.0.1

 I believe I'be been pretty thorough in closing down resultsets,
preparedstatements and connections after use, and use the
removeAbandoned
parameter in the DataSource Resource section of server.xml.

 Any leads are much appreciated.

 thanks
 /j-p.


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: OT: db pool problems - jdbc connection count?

2003-10-30 Thread john-paul delaney
Thanks Oscar... I ran some servlets and observed the postgres processes going over the 
maxActive (33 to 30) limit set in server.xml and also those processes marked idle 
topped the maxIdle value (21 to 15).  The number of processes then dropped to 25, and 
I don't experience any problems with db connection resources.  It appears some 
reclaiming of connections did take place.

I'm as much in the dark as ever regarding the cause of connection resource maxing out 
however.  Any further suggestions on how to test this behaviour given the 
apps/versions belown are much appreciated.

regards
/j-p.


On Thu, 30 Oct 2003, Oscar Carrillo wrote:
 How about just watching the processes for postgresql while you access the 
 site?:
 
 ps auxw | grep postgres
 
  
  tomcat 4.1.24
  postgresql 7.3.3
  pg73jdbc3.jar
  commons-pool 1.0.1
  
  I believe I'be been pretty thorough in closing down resultsets, preparedstatements 
  and connections after use, and use the removeAbandoned parameter in the DataSource 
  Resource section of server.xml.
  


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread john-paul delaney
Thanks Yoav... sorry it's a wee bit above my immediate understanding (e.g lookup my 
connection pool by JNDI name - I could do with an example of what this means) plese be 
patient and point me to a resource that will give me some lead to catch up with you.

regards
/j-p.


On Thu, 30 Oct 2003, Shapira, Yoav wrote:
 
 Howdy,
 You can write a bit of code to do this:
 
 - Create an InitialContext
 - Get the java:comp/env context
 - Lookup your connection pool by JNDI name
 - Cast your connection pool to the appropriate type as specified in your
 server.xml
 
 Then you can call the implementation-specific method, e.g.
 getNumActive() / getNumIdle() for
 org.apache.commons.dbcp.BasicDataSource, to look at values.
 
 Yoav Shapira
 Millennium ChemInformatics



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread Shapira, Yoav

Howdy,
It's very similar to how you get a connection.  Let's say your
datasource is defined in server.xml with name jdbc/myDataSource.
Then:

InitialContext ic = new InitialContext();
DataSource ds = (DataSource)
ic.lookup(java:comp/env/jdbc/myDataSource);

If you wanted a connection, you'd call ds.getConnection().  But you want
to find the number of active connections, which is not part of the
DataSource interface.  So you need to cast ds to the specific type,
which is the type your specified in server.xml.

Assuming that type is org.apache.commons.dbcp.BasicDataSource, you'd do:
BasicDataSourcs bds = (BasicDataSource) ds;
int numActive = bds.getNumActive();
int numIdle = bds.getNumIdle();
System.out.println(There are  + numActive +
 active connections and  + numIdle +
 idle connections in the pool.);

I'm assuming you're using DBCP.  If you're using another connection
pool, the above code must be modified accordingly.

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: john-paul delaney [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 30, 2003 6:30 PM
To: Tomcat Users List
Subject: RE: OT: db pool problems - jdbc connection count?

Thanks Yoav... sorry it's a wee bit above my immediate understanding
(e.g
lookup my connection pool by JNDI name - I could do with an example of
what
this means) plese be patient and point me to a resource that will give
me
some lead to catch up with you.


regards
/j-p.


On Thu, 30 Oct 2003, Shapira, Yoav wrote:

 Howdy,
 You can write a bit of code to do this:

 - Create an InitialContext
 - Get the java:comp/env context
 - Lookup your connection pool by JNDI name
 - Cast your connection pool to the appropriate type as specified in
your
 server.xml

 Then you can call the implementation-specific method, e.g.
 getNumActive() / getNumIdle() for
 org.apache.commons.dbcp.BasicDataSource, to look at values.

 Yoav Shapira
 Millennium ChemInformatics



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread Oscar Carrillo
Thanks for a more complete solution Yoav!

I'm still using a homebrew connection pool, so I'm lacking in some
features. I'm planning on moving to one of the standard connection pools
since they exist now and look quite good.

Can I put your example up on my site when I finally get to doing a HOWTO
on how to do connection pools?

Regards,
Oscar

On Thu, 30 Oct 2003, Shapira, Yoav wrote:

 
 Howdy,
 It's very similar to how you get a connection.  Let's say your
 datasource is defined in server.xml with name jdbc/myDataSource.
 Then:
 
 InitialContext ic = new InitialContext();
 DataSource ds = (DataSource)
 ic.lookup(java:comp/env/jdbc/myDataSource);
 
 If you wanted a connection, you'd call ds.getConnection().  But you want
 to find the number of active connections, which is not part of the
 DataSource interface.  So you need to cast ds to the specific type,
 which is the type your specified in server.xml.
 
 Assuming that type is org.apache.commons.dbcp.BasicDataSource, you'd do:
 BasicDataSourcs bds = (BasicDataSource) ds;
 int numActive = bds.getNumActive();
 int numIdle = bds.getNumIdle();
 System.out.println(There are  + numActive + 
  active connections and  + numIdle + 
  idle connections in the pool.);
 
 I'm assuming you're using DBCP.  If you're using another connection
 pool, the above code must be modified accordingly.
 
 Yoav Shapira
 Millennium ChemInformatics
 
 
 -Original Message-
 From: john-paul delaney [mailto:[EMAIL PROTECTED]
 Sent: Thursday, October 30, 2003 6:30 PM
 To: Tomcat Users List
 Subject: RE: OT: db pool problems - jdbc connection count?
 
 Thanks Yoav... sorry it's a wee bit above my immediate understanding
 (e.g
 lookup my connection pool by JNDI name - I could do with an example of
 what
 this means) plese be patient and point me to a resource that will give
 me
 some lead to catch up with you.
 
 
 regards
 /j-p.
 
 
 On Thu, 30 Oct 2003, Shapira, Yoav wrote:
 
  Howdy,
  You can write a bit of code to do this:
 
  - Create an InitialContext
  - Get the java:comp/env context
  - Lookup your connection pool by JNDI name
  - Cast your connection pool to the appropriate type as specified in
 your
  server.xml
 
  Then you can call the implementation-specific method, e.g.
  getNumActive() / getNumIdle() for
  org.apache.commons.dbcp.BasicDataSource, to look at values.
 
  Yoav Shapira
  Millennium ChemInformatics
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 This e-mail, including any attachments, is a confidential business communication, 
 and may contain information that is confidential, proprietary and/or privileged.  
 This e-mail is intended only for the individual(s) to whom it is addressed, and may 
 not be saved, copied, printed, disclosed or used by anyone else.  If you are not 
 the(an) intended recipient, please immediately delete this e-mail from your computer 
 system and notify the sender.  Thank you.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread Shapira, Yoav

Howdy,

Can I put your example up on my site when I finally get to doing a
HOWTO
on how to do connection pools?

Of course, no problem.

Yoav Shapira




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: OT: db pool problems - jdbc connection count?

2003-10-30 Thread john-paul delaney
Oscar... I'll keep a close lookout for when you publish your HOWTO.  In the meantime, 
I'll try to follow Yoav's instructions, and get back to the list with any eventual 
errors I make.

thanks again to you both,
/j-p.


On Thu, 30 Oct 2003, Oscar Carrillo wrote:

 Thanks for a more complete solution Yoav!
 
 I'm still using a homebrew connection pool, so I'm lacking in some
 features. I'm planning on moving to one of the standard connection pools
 since they exist now and look quite good.
 
 Can I put your example up on my site when I finally get to doing a HOWTO
 on how to do connection pools?
 
 Regards,
 Oscar
 
 On Thu, 30 Oct 2003, Shapira, Yoav wrote:
 
  
  Howdy,
  It's very similar to how you get a connection.  Let's say your
  datasource is defined in server.xml with name jdbc/myDataSource.
  Then:
  
  InitialContext ic = new InitialContext();
  DataSource ds = (DataSource)
  ic.lookup(java:comp/env/jdbc/myDataSource);
  
  If you wanted a connection, you'd call ds.getConnection().  But you want
  to find the number of active connections, which is not part of the
  DataSource interface.  So you need to cast ds to the specific type,
  which is the type your specified in server.xml.
  
  Assuming that type is org.apache.commons.dbcp.BasicDataSource, you'd do:
  BasicDataSourcs bds = (BasicDataSource) ds;
  int numActive = bds.getNumActive();
  int numIdle = bds.getNumIdle();
  System.out.println(There are  + numActive + 
   active connections and  + numIdle + 
   idle connections in the pool.);
  
  I'm assuming you're using DBCP.  If you're using another connection
  pool, the above code must be modified accordingly.
  
  Yoav Shapira
  Millennium ChemInformatics
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]