RE: ConnectionPool question

2009-11-05 Thread Propes, Barry L
To: Tomcat Users List Subject: Re: ConnectionPool question As far as I remember, abandoned is a connection that was not closed. So if you call recycle on a connection it will not generate abandoned message. The messages that you see are from connections that you do not close. I also remember

RE: ConnectionPool question

2009-11-05 Thread Caldarale, Charles R
From: Propes, Barry L [mailto:barry.l.pro...@citi.com] Subject: RE: ConnectionPool question When I FIRST make a DB query through one of my JSPs/servlets, I get this msg printed to the console. AbandonedObjectPool is used (org.apache.commons.dbcp.abandonedobjectp...@b32627

RE: ConnectionPool question

2009-11-05 Thread Propes, Barry L
Users List Subject: RE: ConnectionPool question From: Propes, Barry L [mailto:barry.l.pro...@citi.com] Subject: RE: ConnectionPool question When I FIRST make a DB query through one of my JSPs/servlets, I get this msg printed to the console. AbandonedObjectPool is used

Re: ConnectionPool question

2009-11-05 Thread Josh Gooding
2:52 PM To: Tomcat Users List Subject: RE: ConnectionPool question From: Propes, Barry L [mailto:barry.l.pro...@citi.com] Subject: RE: ConnectionPool question When I FIRST make a DB query through one of my JSPs/servlets, I get this msg printed to the console. AbandonedObjectPool

Re: ConnectionPool question

2009-11-05 Thread Elli Albek
Hi, Elli, On 11/4/2009 7:01 PM, Elli Albek wrote: I also remember that closing a connection closes statements and result sets, but it has been a while since I read the source. Pooled connections are almost certainly not behaving this way. This has been discussed at least twice in the

Re: ConnectionPool question

2009-11-04 Thread Josh Gooding
HOLY MOLY I am getting a TON of abandoned connection warnings now. I see I have logAbandoned=true. My Catalina log grew fast! Now here is a question, everytime I recycle a connection (close RS, statement, and the connection) does it place it back into the pool or is that what the abandoned

Re: ConnectionPool question

2009-11-04 Thread Carsten Pohl
:56:20 GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: Re: ConnectionPool question HOLY MOLY I am getting a TON of abandoned connection warnings now. I see I have logAbandoned=true. My Catalina log grew fast! Now here is a question, everytime I recycle a connection

Re: ConnectionPool question

2009-11-04 Thread ramzi khlil
- From: Josh Gooding josh.good...@gmail.com To: Tomcat Users List users@tomcat.apache.org Sent: Wednesday, 4 November, 2009 14:56:20 GMT +01:00 Amsterdam / Berlin / Bern / Rome / Stockholm / Vienna Subject: Re: ConnectionPool question HOLY MOLY I am getting a TON of abandoned connection

RE: ConnectionPool question

2009-11-04 Thread Caldarale, Charles R
From: Josh Gooding [mailto:josh.good...@gmail.com] Subject: Re: ConnectionPool question everytime I recycle a connection (close RS, statement, and the connection) does it place it back into the pool or is that what the abandoned connection messages are for letting me know they were

Re: ConnectionPool question

2009-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 11/3/2009 3:24 PM, Josh Gooding wrote: If I close the RS, can I still use the MD? I see you've already answered this, but note the error is that the Connection is closed, not the ResultSet. I would expect that ResultSetMetaData requires

Re: ConnectionPool question

2009-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 11/4/2009 10:06 AM, Caldarale, Charles R wrote: If a webapp fails to close a connection wrapper and its associated real connection stays idle beyond the configured limit, the association between the wrapper and real connection is

Re: ConnectionPool question

2009-11-04 Thread Josh Gooding
Chris, I would imagine that you are correct, unless I store the RSMD in anther object (like a Map or AL). Now that I have started closing my resources something strange has actually happened now. I've hit the connectionpool limit faster. I was digging and realized that I changed my context.xml

RE: ConnectionPool question

2009-11-04 Thread Caldarale, Charles R
From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: ConnectionPool question I believe both the real connection and the wrapper are discarded. Yes; I should have said the real connection is closed and a new real one created for the pool. - Chuck

Re: ConnectionPool question

2009-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 11/4/2009 1:17 PM, Caldarale, Charles R wrote: From: Christopher Schultz [mailto:ch...@christopherschultz.net] Subject: Re: ConnectionPool question I believe both the real connection and the wrapper are discarded. Yes; I should

Re: ConnectionPool question

2009-11-04 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 11/4/2009 12:11 PM, Josh Gooding wrote: type=javax.sql.DataSource [snip] res-typejavax.sql.DataSource/res-type I believe it is these types that must match, and they do. Don't change a thing. - -chris -BEGIN PGP

Re: ConnectionPool question

2009-11-04 Thread Elli Albek
As far as I remember, abandoned is a connection that was not closed. So if you call recycle on a connection it will not generate abandoned message. The messages that you see are from connections that you do not close. I also remember that closing a connection closes statements and result sets, but

Re: ConnectionPool question

2009-11-03 Thread Josh Gooding
If I close the RS, can I still use the MD? On Tue, Nov 3, 2009 at 3:13 PM, Elli Albek e...@sustainlane.com wrote: No, you do not need to close the XXXMetaData classes. E On Tue, Nov 3, 2009 at 12:02 PM, Josh Gooding josh.good...@gmail.com wrote: One more question on bleeding resources.

Re: ConnectionPool question

2009-11-03 Thread Josh Gooding
Elle, I am going to dig into this code and check it out. I want to know more about how to use threadlocal and filters. (Sorry I'm not as experienced in Tomcat as some for you gurus here). The code looks promising and I like the 2nd option due to the fact that each HTTP req. only has one

Re: ConnectionPool question

2009-11-03 Thread Josh Gooding
nevermind. I get: javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed. Guess that answers my question. On Tue, Nov 3, 2009 at 3:24 PM, Josh Gooding josh.good...@gmail.com wrote: If I close the

Re: ConnectionPool question

2009-11-03 Thread Josh Gooding
One more question on bleeding resources. When closing RS / statement / connections. Do I have to do anything with the MetaData if I got that as well? (I.E Do I explicitly have to close the metadata as well?) Josh On Tue, Nov 3, 2009 at 2:01 PM, Josh Gooding josh.good...@gmail.com wrote:

Re: ConnectionPool question

2009-11-03 Thread Elli Albek
No, you do not need to close the XXXMetaData classes. E On Tue, Nov 3, 2009 at 12:02 PM, Josh Gooding josh.good...@gmail.comwrote: One more question on bleeding resources. When closing RS / statement / connections. Do I have to do anything with the MetaData if I got that as well? (I.E Do

Re: ConnectionPool question

2009-11-02 Thread Elli Albek
Here is some idea for you: First, you have two static methods to get and return the connection inside a listener class. Those methods do not have anything to do with the listener (which is an instance), and also and also do not need synchronization. Synchronizing on getConnection can be a big

Re: ConnectionPool question

2009-11-02 Thread Elli Albek
Oops, I had a copy paste error. Version 2 has the filter method twice. Ignore the first, use the second. Notice this code was written in an email client, not an IDE :) E

Re: ConnectionPool question

2009-11-02 Thread Konstantin Kolinko
2009/10/31 Josh Gooding josh.good...@gmail.com: (...)  and I am getting a tomcat startup exception: WARNING: Unexpected exception resolving reference java.lang.IllegalArgumentException    at java.util.concurrent.ArrayBlockingQueue.init(Unknown Source)    at

Re: ConnectionPool question

2009-11-02 Thread Josh Gooding
It seems as though you cannot set the maxActive to -1 as you can in the javax.sql.ConnectionPool for unlimited. On Mon, Nov 2, 2009 at 4:36 AM, Konstantin Kolinko knst.koli...@gmail.comwrote: 2009/10/31 Josh Gooding josh.good...@gmail.com: (...) and I am getting a tomcat startup exception:

Re: ConnectionPool question

2009-11-02 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Elli, On 11/2/2009 4:08 AM, Elli Albek wrote: I think you can have a solution without changing your code. Try something like this: getConnection() static method should get the connection, and add it to a list that you keep in threadlocal.

Re: ConnectionPool question

2009-10-30 Thread Filip Hanik - Dev Lists
hi Josh, calling Connection.close() does not close statements and resultsets. There is an interceptor you can configure called StatementFinalizer that does exactly that during the close call. Filip On 10/29/2009 07:17 PM, Josh Gooding wrote: I wrote some code on top of the Tomcat's

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
I have been reading it and ALMOST chimed in, but decided to read farther first. While I asked a question about it on the sun forums and got slammed for a class I wrote and posted about why a ConnectionPool would ever have to implement ServletContextListener. basically I was told to write in

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
AHH, I will read the API for the StatementFinalizer. I was looking at something to do that. Thank you Filip! On Fri, Oct 30, 2009 at 9:53 AM, Filip Hanik - Dev Lists devli...@hanik.com wrote: hi Josh, calling Connection.close() does not close statements and resultsets. There is an

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
Hey what API holds the statementFinalizer? On Fri, Oct 30, 2009 at 9:57 AM, Josh Gooding josh.good...@gmail.comwrote: AHH, I will read the API for the StatementFinalizer. I was looking at something to do that. Thank you Filip! On Fri, Oct 30, 2009 at 9:53 AM, Filip Hanik - Dev Lists

Re: ConnectionPool question

2009-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 10/30/2009 9:54 AM, Josh Gooding wrote: While I asked a question about it on the sun forums and got slammed for a class I wrote and posted about why a ConnectionPool would ever have to implement ServletContextListener. basically I was

Re: ConnectionPool question

2009-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Filip, On 10/30/2009 9:53 AM, Filip Hanik - Dev Lists wrote: There is an interceptor you can configure called StatementFinalizer that does exactly that during the close call. Can you point me to some documentation for this? The only thing I can

Re: ConnectionPool question

2009-10-30 Thread Filip Hanik - Dev Lists
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java?view=log Filip On 10/30/2009 08:34 AM, Josh Gooding wrote: Hey what API holds the statementFinalizer? On Fri, Oct 30, 2009 at 9:57 AM, Josh

Re: ConnectionPool question

2009-10-30 Thread Filip Hanik - Dev Lists
look at jdbc-pool.html it has all the info, here are examples out of it Configuration Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource factory=org.apache.tomcat.jdbc.pool.DataSourceFactory testWhileIdle=true

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
On Fri, Oct 30, 2009 at 11:33 AM, Christopher Schultz ch...@christopherschultz.net wrote: Heh. Obviously, someone hasn't worked in the real world. Did he realize that writing to the contract in this case could potentially bring-down the database server? Eh, I just let it go. I'm beyond

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
Wait a second. What I am seeing from you Filip and what I have in my context.xml are similar: Context WatchedResourceWEB-INF/web.xml/WatchedResource Resource name=jdbc/RealmDB auth=Container type=javax.sql.DataSource username=root password=password

Re: ConnectionPool question

2009-10-30 Thread Filip Hanik - Dev Lists
nope, you're using commons-dbcp, see the factory attribute in my config Filip On 10/30/2009 12:22 PM, Josh Gooding wrote: Wait a second. What I am seeing from you Filip and what I have in my context.xml are similar: Context WatchedResourceWEB-INF/web.xml/WatchedResource Resource

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
I also found this tid bit lying around. It get's a connection, but doesn't close the statement. public static void closeResources(ResultSet rs) throws AardvarkResourceException { try { Statement s = rs.getStatement(); if (s != null) { // ResultSets produced by

Re: ConnectionPool question

2009-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 10/30/2009 2:10 PM, Josh Gooding wrote: Oh this code BLEEDS resources. The only semi annoyance is that the methods that get RS's are usually returned like: return

Re: ConnectionPool question

2009-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 10/30/2009 2:42 PM, Josh Gooding wrote: I also found this tid bit lying around. It get's a connection, but doesn't close the statement. Might I suggest the following changes: public static void closeResources(ResultSet rs) throws

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
-Original Message- From: Josh Gooding [mailto:josh.good...@gmail.com] Sent: Friday, October 30, 2009 1:11 PM To: Tomcat Users List Subject: Re: ConnectionPool question This is not bad, but there is NO PLACE in the code that actively closes all of the resources. Sometimes the code

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
Hey Filip, I do not have /jdbc/pool/DataSourceFactory in my tomcat-dbcp.jar. Is there some other place I should look? My jar's structure goes as: org/apache/tomcat/ dbcp jocl pool Under the dbcp I have a DataSourceConnectionFactory.class (which I am making an assumption that is what it is.)

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
: Josh Gooding [mailto:josh.good...@gmail.com] Sent: Friday, October 30, 2009 1:43 PM To: Tomcat Users List Subject: Re: ConnectionPool question I also found this tid bit lying around. It get's a connection, but doesn't close the statement. public static void closeResources(ResultSet rs

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
: ConnectionPool question I also found this tid bit lying around. It get's a connection, but doesn't close the statement. public static void closeResources(ResultSet rs) throws AardvarkResourceException { try { Statement s = rs.getStatement(); if (s != null

Re: ConnectionPool question

2009-10-30 Thread Filip Hanik - Dev Lists
When you said you used the Tomcat ConnectionPool class, I simply assumed that you were using the new pool being developed at Tomcat http://people.apache.org/~fhanik/jdbc-pool/v1.0.7.1/ the org.apache.tomcat.dbcp is the same as the commons-dbcp, just renamed to avoid class naming conflicts

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
. Is the AardvarkResource a previously designated DB datasource class, written by the previous developer? -Original Message- From: Josh Gooding [mailto:josh.good...@gmail.com] Sent: Friday, October 30, 2009 3:32 PM To: Tomcat Users List Subject: Re: ConnectionPool question Barry I

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
- From: Josh Gooding [mailto:josh.good...@gmail.com] Sent: Friday, October 30, 2009 1:23 PM To: Tomcat Users List Subject: Re: ConnectionPool question Wait a second. What I am seeing from you Filip and what I have in my context.xml are similar: Context WatchedResourceWEB-INF/web.xml

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
, written by the previous developer? -Original Message- From: Josh Gooding [mailto:josh.good...@gmail.com] Sent: Friday, October 30, 2009 3:32 PM To: Tomcat Users List Subject: Re: ConnectionPool question Barry I changed the code to this: public static void closeResources(ResultSet

Re: ConnectionPool question

2009-10-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 10/30/2009 4:31 PM, Josh Gooding wrote: public static void closeResources(ResultSet rs) throws AardvarkResourceException { Statement s = null; Connection c = null; try { s = rs.getStatement();

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
Filip I grabbed the tomcat-jdbc.jar file and included it under the /lib folder in my tomcat installation. I modified my context.xml's resource tag to the following: Resource name=jdbc/RealmDB auth=Container type=javax.sql.DataSource

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
Chris, I was looking at that earlier, wondering why it was put in there in the first place. It just doesn't fit in. Sometimes you just hate to inherit someone else's mess. While there is another school of thought telling me to re-write the entire DAO (which I could be willing to later on) for

Re: ConnectionPool question

2009-10-29 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 10/29/2009 9:17 PM, Josh Gooding wrote: I wrote some code on top of the Tomcat's ConnectionPool class. In regular Java based programming if I close a ResultSet with connection.close(), this frees up both the statement and resultset's