RE: [OT] ConnectionPool question

2009-11-11 Thread Propes, Barry L
That's good stuff, Chuck - and sadly, so prevalent among many places as the thought process. -Original Message- From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com] Sent: Wednesday, November 11, 2009 2:34 PM To: Tomcat Users List Subject: RE: [OT] ConnectionPool que

Re: [OT] ConnectionPool question

2009-11-11 Thread Josh Gooding
rale, Charles R < chuck.caldar...@unisys.com> wrote: > > From: Josh Gooding [mailto:josh.good...@gmail.com] > > Subject: Re: [OT] ConnectionPool question > > > > Not only did I get yelled at for having the audacity to write up > > procedures for the developers on my tea

RE: [OT] ConnectionPool question

2009-11-11 Thread Caldarale, Charles R
> From: Josh Gooding [mailto:josh.good...@gmail.com] > Subject: Re: [OT] ConnectionPool question > > Not only did I get yelled at for having the audacity to write up > procedures for the developers on my team "But we've always done it that way..." "A long

Re: [OT] ConnectionPool question

2009-11-11 Thread Josh Gooding
Chris, I AM going to use Elli's suggestion. It's going to take some time, but I don't have to worry, once it's done, it'll be done correctly. Not only did I get yelled at for having the audacity to write up procedures for the developers on my team (assuming I ever get a another team), but I told

Re: [OT] ConnectionPool question

2009-11-10 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Josh, On 11/10/2009 9:18 AM, Josh Gooding wrote: > the reason there are multiple recycleConnection methods is because if a RS > is passed to the front presentation layer, I have to have a way to close it, > I have to be able to get the statement and c

Re: [OT] ConnectionPool question

2009-11-10 Thread Josh Gooding
I'm glad I amuse all of you :P Chris, the reason there are multiple recycleConnection methods is because if a RS is passed to the front presentation layer, I have to have a way to close it, I have to be able to get the statement and connection somehow, and I don't want that in my code. >From

Re: [OT] ConnectionPool question

2009-11-07 Thread Elli Albek
Chris, as long as we are having fun its all good. I think this question is something many developers ask. I have seen it here and in other forums. You are correct, everything is wrapped. The connection wrapper spawns statment wrappers which spawn result set wrappers, and everything is tracked in p

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

Re: ConnectionPool question

2009-11-05 Thread Josh Gooding
ailto:chuck.caldar...@unisys.com] > Sent: Thursday, November 05, 2009 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 > >

RE: ConnectionPool question

2009-11-05 Thread Propes, Barry L
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. > &

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.ab

RE: ConnectionPool question

2009-11-05 Thread Propes, Barry L
04, 2009 6:02 PM 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 no

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, bu

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] > javax.sql.DataSource I believe it is these types that must match, and they do. Don't change a thing. - -chris -BEGIN PGP SIGNATURE- Ver

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 ar

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. -

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 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 sev

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 t

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

Re: ConnectionPool question

2009-11-04 Thread ramzi khlil
- Original Message - > From: "Josh Gooding" > To: "Tomcat Users List" > 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 ab

Re: ConnectionPool question

2009-11-04 Thread Carsten Pohl
rdam / 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 (close RS,

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-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 wrote: > 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

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 wrote: > Elle, > > I am going to d

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 wrote: > If I close the RS, can I still use the

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 connect

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 wrote: > No, you do not need to close the XXXMetaData classes. > > E > > On Tue, Nov 3, 2009 at 12:02 PM, Josh Gooding >wrote: > > > One more question on bleeding resources. When closing RS / statement / > >

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-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 wrote: > 2009/10/31 Josh Gooding : > >(...) > > and I am getting a tomcat startup exception: > > > > WARNING: Unexpected exception

Re: ConnectionPool question

2009-11-02 Thread Konstantin Kolinko
2009/10/31 Josh Gooding : >(...) >  and I am getting a tomcat startup exception: > > WARNING: Unexpected exception resolving reference > java.lang.IllegalArgumentException >    at java.util.concurrent.ArrayBlockingQueue.(Unknown Source) >    at > org.apache.tomcat.jdbc.pool.ConnectionPool.init(Conn

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 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 bott

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 r

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: and I am getting a tomcat startup exception: WARNING: Unexpected exception resolving reference java.lang.IllegalArgumentExceptio

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
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: ConnectionPo

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
, 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: WEB-INF/web.xml My ConnectionPool class: import java.sql.Connection; import java.sql.SQLException

RE: ConnectionPool question

2009-10-30 Thread Propes, Barry L
, 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 rs

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 Fil

Re: ConnectionPool question

2009-10-30 Thread Josh Gooding
on gets recycled. > Theoretically. > > Seems like you put a finally block down there to try catching/closing the > wayward connection. > > > -Original Message- > From: Josh Gooding [mailto:josh.good...@gmail.com] > Sent: Friday, October 30, 2009 1:43 PM > To: T

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(Re

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.) O

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 is

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 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 > ConnectionPool.getConnection().createStatement().executeQuery(

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 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: WEB-INF/web.xml My ConnectionPool class: import java.s

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: WEB-INF/web.xml My ConnectionPool class: import java.sql.Connection; import java.sql.SQLException; import javax.naming.InitialContext; import javax.servlet.ServletContextEvent; import

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 be

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 Code: import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import org.apache.tomcat.jdbc.pool.DataSource; import org.apache.tomcat.jdbc.pool.

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 Goodingwrote: AHHH

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 f

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 Josh Gooding
Hey what API holds the statementFinalizer? On Fri, Oct 30, 2009 at 9:57 AM, Josh Gooding wrote: > 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.

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 wrote: > hi Josh, calling Connection.close() does not close statements and > resultsets. > There is an interceptor you can c

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 accor

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 Connectio

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 m

ConnectionPool question

2009-10-29 Thread Josh Gooding
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 memory associated with the connection if it was still open. If I close a connection with Tomcat's Conne