Thread: Re: Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3
Hi Tony, The java guys here are wondering why it's necessary to explicitely close the connections to the database in their .jsp's, as the java garbage collector should do this automatically? :-) Regards and best wishes, Justin Clift -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi
Why don't you use the JBoss - Catalina association ... JBoss provides Connection Pooling...via proper MBean configuration I believe then you don't need to release the ***connection*** - at worst the pooled connection :-)). As I am working on the issue at the moment I cannot tell you more about it but I guarantee you that this is the way to work ;-)) Rgds, Thomas, -- Thomas SMETS rue J. Wytsmanstraat 62 1050 Bruxelles yahoo-id : smetsthomas ----- Original Message ----- From: "Justin Clift" <justin@postgresql.org> To: "Tony Grant" <tony@animaproductions.com> Cc: <pgsql-jdbc@postgresql.org>; "Hari Yellina" <hyellina@iprimus.com.au> Sent: 06 March, 2002 7:46 AM Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > Hi Tony, > > The java guys here are wondering why it's necessary to explicitely close > the connections to the database in their .jsp's, as the java garbage > collector should do this automatically? > > :-) > > Regards and best wishes, > > Justin Clift > > -- > "My grandfather once told me that there are two kinds of people: those > who work and those who take the credit. He told me to try to be in the > first group; there was less competition there." > - Indira Gandhi > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly >
Hi Thomas, We're using Tomcat 3.2.4, and we're just about to go into production. There isn't any possible way of convincing the management people we should go to Catalina, unless there is absolutely no other way of making the system work stable. I'm not familiar with JBoss, but I'll pass your message onto the Java guys so they can look it up and check it out. :-) Regards and best wishes, Justin Clift tsmets@brutele.be wrote: > > Why don't you use the JBoss - Catalina association ... > JBoss provides Connection Pooling...via proper MBean configuration > I believe then you don't need to release the ***connection*** - at worst the > pooled connection :-)). > As I am working on the issue at the moment I cannot tell you more about it > but I guarantee you that this is the way to work ;-)) > > Rgds, > > Thomas, > > -- > Thomas SMETS > rue J. Wytsmanstraat 62 > 1050 Bruxelles > yahoo-id : smetsthomas > > ----- Original Message ----- > From: "Justin Clift" <justin@postgresql.org> > To: "Tony Grant" <tony@animaproductions.com> > Cc: <pgsql-jdbc@postgresql.org>; "Hari Yellina" <hyellina@iprimus.com.au> > Sent: 06 March, 2002 7:46 AM > Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > > > Hi Tony, > > > > The java guys here are wondering why it's necessary to explicitely close > > the connections to the database in their .jsp's, as the java garbage > > collector should do this automatically? > > > > :-) > > > > Regards and best wishes, > > > > Justin Clift > > > > -- > > "My grandfather once told me that there are two kinds of people: those > > who work and those who take the credit. He told me to try to be in the > > first group; there was less competition there." > > - Indira Gandhi > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi
Justin, I didn't say JBoss 3 / Tomcat 4 was the way to go ! I just mentionned that JBoss offered a tight integration with "Tomcat" (& also with the latest version known as catalina). I you need connection pooling, just chuck a look @ : http://www.coreservlets.com And especially this page : http://archive.coreservlets.com/Chapter18.html, look at the following * ConnectionPool.java A class for preallocating, recycling, and managing JDBC connections. * ConnectionPoolServlet.java A servlet that reads information from a database and presents it in an HTML table. It uses connection pooling to optimize the database retrieval. A good timing test case is .... This however the quick & dirty way to do it (All my respect to Marty Hall) but believe it's alway proper to use the native AS dependent connection pooler which is often better that an example one ! Rgds, Thomas, -- Thomas SMETS rue J. Wytsmanstraat 62 1050 Bruxelles yahoo-id : smetsthomas ----- Original Message ----- From: "Justin Clift" <justin@postgresql.org> To: <tsmets@brutele.be> Cc: "pgsql jdbc" <pgsql-jdbc@postgresql.org>; <hyellina@iprimus.com.au> Sent: 06 March, 2002 10:33 AM Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > Hi Thomas, > > We're using Tomcat 3.2.4, and we're just about to go into production. > There isn't any possible way of convincing the management people we > should go to Catalina, unless there is absolutely no other way of making > the system work stable. > > I'm not familiar with JBoss, but I'll pass your message onto the Java > guys so they can look it up and check it out. > > :-) > > Regards and best wishes, > > Justin Clift > > > tsmets@brutele.be wrote: > > > > Why don't you use the JBoss - Catalina association ... > > JBoss provides Connection Pooling...via proper MBean configuration > > I believe then you don't need to release the ***connection*** - at worst the > > pooled connection :-)). > > As I am working on the issue at the moment I cannot tell you more about it > > but I guarantee you that this is the way to work ;-)) > > > > Rgds, > > > > Thomas, > > > > -- > > Thomas SMETS > > rue J. Wytsmanstraat 62 > > 1050 Bruxelles > > yahoo-id : smetsthomas > > > > ----- Original Message ----- > > From: "Justin Clift" <justin@postgresql.org> > > To: "Tony Grant" <tony@animaproductions.com> > > Cc: <pgsql-jdbc@postgresql.org>; "Hari Yellina" <hyellina@iprimus.com.au> > > Sent: 06 March, 2002 7:46 AM > > Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > > > > > Hi Tony, > > > > > > The java guys here are wondering why it's necessary to explicitely close > > > the connections to the database in their .jsp's, as the java garbage > > > collector should do this automatically? > > > > > > :-) > > > > > > Regards and best wishes, > > > > > > Justin Clift > > > > > > -- > > > "My grandfather once told me that there are two kinds of people: those > > > who work and those who take the credit. He told me to try to be in the > > > first group; there was less competition there." > > > - Indira Gandhi > > > > > > ---------------------------(end of broadcast)--------------------------- > > > TIP 3: if posting/reading through Usenet, please send an appropriate > > > subscribe-nomail command to majordomo@postgresql.org so that your > > > message can get through to the mailing list cleanly > > > > > -- > "My grandfather once told me that there are two kinds of people: those > who work and those who take the credit. He told me to try to be in the > first group; there was less competition there." > - Indira Gandhi >
Justin, Because Garbage Collection is not a guaranteed process. You have no guarantee when it is going to run. This could get you into a situation where you have no more connections and no way to get them. A much better solution is a pool, then you don't incur the overhead of starting the connection. Dave -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Justin Clift Sent: Wednesday, March 06, 2002 1:46 AM To: Tony Grant Cc: pgsql-jdbc@postgresql.org; Hari Yellina Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 Hi Tony, The java guys here are wondering why it's necessary to explicitely close the connections to the database in their .jsp's, as the java garbage collector should do this automatically? :-) Regards and best wishes, Justin Clift -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
Pooled connections aren't rocket science. There are quite a few freely available, poolman for one. Assuming you only want to connect to one db: They can be as simple as a linked list where you get the connection off the head, and return it back to the tail. There's a little bit of housekeeping when they come back to make sure there aren't any warnings, and that the connection is in a non-transaction mode, etc. Dave -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Justin Clift Sent: Wednesday, March 06, 2002 4:33 AM To: tsmets@brutele.be Cc: pgsql jdbc; hyellina@iprimus.com.au Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 Hi Thomas, We're using Tomcat 3.2.4, and we're just about to go into production. There isn't any possible way of convincing the management people we should go to Catalina, unless there is absolutely no other way of making the system work stable. I'm not familiar with JBoss, but I'll pass your message onto the Java guys so they can look it up and check it out. :-) Regards and best wishes, Justin Clift tsmets@brutele.be wrote: > > Why don't you use the JBoss - Catalina association ... > JBoss provides Connection Pooling...via proper MBean configuration I > believe then you don't need to release the ***connection*** - at worst > the pooled connection :-)). As I am working on the issue at the moment > I cannot tell you more about it but I guarantee you that this is the > way to work ;-)) > > Rgds, > > Thomas, > > -- > Thomas SMETS > rue J. Wytsmanstraat 62 > 1050 Bruxelles > yahoo-id : smetsthomas > > ----- Original Message ----- > From: "Justin Clift" <justin@postgresql.org> > To: "Tony Grant" <tony@animaproductions.com> > Cc: <pgsql-jdbc@postgresql.org>; "Hari Yellina" > <hyellina@iprimus.com.au> > Sent: 06 March, 2002 7:46 AM > Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > > > Hi Tony, > > > > The java guys here are wondering why it's necessary to explicitely > > close the connections to the database in their .jsp's, as the java > > garbage collector should do this automatically? > > > > :-) > > > > Regards and best wishes, > > > > Justin Clift > > > > -- > > "My grandfather once told me that there are two kinds of people: > > those who work and those who take the credit. He told me to try to > > be in the first group; there was less competition there." > > - Indira Gandhi > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 3: if posting/reading through Usenet, please send an appropriate > > subscribe-nomail command to majordomo@postgresql.org so that your > > message can get through to the mailing list cleanly > > -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
Dave, I know it's not rocket science... (not that I took the remark personnally ;-) ) What I meant is that you are usually beter off with the default Connexion poller provided by the AS (potentially JBoss in our conversation) than a default one ... This is a personnal opinion & not a proven matter :-)) Rgrds, Thomas, -- Thomas SMETS rue J. Wytsmanstraat 62 1050 Bruxelles yahoo-id : smetsthomas ----- Original Message ----- From: "Dave Cramer" <Dave@micro-automation.net> To: "'Justin Clift'" <justin@postgresql.org>; <tsmets@brutele.be> Cc: "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>; <hyellina@iprimus.com.au> Sent: 06 March, 2002 1:30 PM Subject: RE: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > Pooled connections aren't rocket science. There are quite a few freely > available, poolman for one. > > > Assuming you only want to connect to one db: > They can be as simple as a linked list where you get the connection off > the head, and return it back to the tail. There's a little bit of > housekeeping when they come back to make sure there aren't any warnings, > and that the connection is in a non-transaction mode, etc. > > > Dave > > -----Original Message----- > From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Justin Clift > Sent: Wednesday, March 06, 2002 4:33 AM > To: tsmets@brutele.be > Cc: pgsql jdbc; hyellina@iprimus.com.au > Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > > > Hi Thomas, > > We're using Tomcat 3.2.4, and we're just about to go into production. > There isn't any possible way of convincing the management people we > should go to Catalina, unless there is absolutely no other way of making > the system work stable. > > I'm not familiar with JBoss, but I'll pass your message onto the Java > guys so they can look it up and check it out. > > :-) > > Regards and best wishes, > > Justin Clift > > > tsmets@brutele.be wrote: > > > > Why don't you use the JBoss - Catalina association ... > > JBoss provides Connection Pooling...via proper MBean configuration I > > believe then you don't need to release the ***connection*** - at worst > > > the pooled connection :-)). As I am working on the issue at the moment > > > I cannot tell you more about it but I guarantee you that this is the > > way to work ;-)) > > > > Rgds, > > > > Thomas, > > > > -- > > Thomas SMETS > > rue J. Wytsmanstraat 62 > > 1050 Bruxelles > > yahoo-id : smetsthomas > > > > ----- Original Message ----- > > From: "Justin Clift" <justin@postgresql.org> > > To: "Tony Grant" <tony@animaproductions.com> > > Cc: <pgsql-jdbc@postgresql.org>; "Hari Yellina" > > <hyellina@iprimus.com.au> > > Sent: 06 March, 2002 7:46 AM > > Subject: Re: [JDBC] Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3 > > > > > Hi Tony, > > > > > > The java guys here are wondering why it's necessary to explicitely > > > close the connections to the database in their .jsp's, as the java > > > garbage collector should do this automatically? > > > > > > :-) > > > > > > Regards and best wishes, > > > > > > Justin Clift > > > > > > -- > > > "My grandfather once told me that there are two kinds of people: > > > those who work and those who take the credit. He told me to try to > > > be in the first group; there was less competition there." > > > - Indira Gandhi > > > > > > ---------------------------(end of > > > broadcast)--------------------------- > > > TIP 3: if posting/reading through Usenet, please send an appropriate > > > subscribe-nomail command to majordomo@postgresql.org so that your > > > message can get through to the mailing list cleanly > > > > > -- > "My grandfather once told me that there are two kinds of people: those > who work and those who take the credit. He told me to try to be in the > first group; there was less competition there." > - Indira Gandhi > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) > > >
At 07:30 AM 3/6/2002, Dave Cramer wrote: >Pooled connections aren't rocket science. There are quite a few freely >available, poolman for one. For what it's worth, I never got Poolman 2.0.4 to work with the JDBC 7.2 drivers; occasionally and for no reason it would give me spurious errors on perfectly good SQL. I posted about it a week or two ago on this list. I received no replies, and furthermore got no replies from the author(s) and found little information about it on the net. I now use Protomatter (protomatter.sourceforge.net) and have had very good success with it. It's a more simple implementation, hence, probably faster and/or more bug free, and the author has been very talkative and has implemented some enhancements/repairs that I have suggested/provided. Also to back up what Dave said - you never know when and/or even if the GC is going to collect your connections, so always close them in a finally block. The beauty of GC is that it's non-deterministic and allows you to be sloppy. The horror of GC is that it's non-deterministic and allows you to be sloppy. Cheers, Doug
JBoss docs mentions that the 7.x driver jdbc7.0-1.2.jar is causing troubles with : <quote> Extreme Java "long" values will cause SQLExceptions and may corrupt the driver so that further actions will fail. </quote> A bit further they mention : <quote> You must include a User name and password. They can be bogus if your PostgreSQL in to trust the machine you are coming from, but you cannot leave them out. </quote> Rgds, THomas, -- Thomas SMETS rue J. Wytsmanstraat 62 1050 Bruxelles yahoo-id : smetsthomas ----- Original Message ----- From: "Doug Fields" <dfields-postgres@pexicom.com> To: <Dave@micro-automation.net> Cc: "'Justin Clift'" <justin@postgresql.org>; <tsmets@brutele.be>; "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>; <hyellina@iprimus.com.au> Sent: 06 March, 2002 4:27 PM Subject: Re: [JDBC] Pooled Connections (was Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3) > At 07:30 AM 3/6/2002, Dave Cramer wrote: > >Pooled connections aren't rocket science. There are quite a few freely > >available, poolman for one. > > For what it's worth, I never got Poolman 2.0.4 to work with the JDBC 7.2 > drivers; occasionally and for no reason it would give me spurious errors on > perfectly good SQL. I posted about it a week or two ago on this list. I > received no replies, and furthermore got no replies from the author(s) and > found little information about it on the net. > > I now use Protomatter (protomatter.sourceforge.net) and have had very good > success with it. It's a more simple implementation, hence, probably faster > and/or more bug free, and the author has been very talkative and has > implemented some enhancements/repairs that I have suggested/provided. > > Also to back up what Dave said - you never know when and/or even if the GC > is going to collect your connections, so always close them in a finally > block. The beauty of GC is that it's non-deterministic and allows you to be > sloppy. The horror of GC is that it's non-deterministic and allows you to > be sloppy. > > Cheers, > > Doug > >
Re: Pooled Connections (was Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3)
From
"Dave Cramer"
Date:
I think you will find that you can leave the password out now, and updating to the latest driver may improve the first problem too Dave -----Original Message----- From: pgsql-jdbc-owner@postgresql.org [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of tsmets@brutele.be Sent: Wednesday, March 06, 2002 10:51 AM To: Doug Fields; pgsql jdbc Subject: Re: [JDBC] Pooled Connections (was Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3) JBoss docs mentions that the 7.x driver jdbc7.0-1.2.jar is causing troubles with: <quote> Extreme Java "long" values will cause SQLExceptions and may corrupt the driver so that further actions will fail. </quote> A bit further they mention : <quote> You must include a User name and password. They can be bogus if your PostgreSQL in to trust the machine you are coming from, but you cannot leave them out. </quote> Rgds, THomas, -- Thomas SMETS rue J. Wytsmanstraat 62 1050 Bruxelles yahoo-id: smetsthomas ----- Original Message ----- From: "Doug Fields" <dfields-postgres@pexicom.com> To: <Dave@micro-automation.net> Cc: "'Justin Clift'" <justin@postgresql.org>; <tsmets@brutele.be>; "'pgsql jdbc'" <pgsql-jdbc@postgresql.org>; <hyellina@iprimus.com.au> Sent: 06 March, 2002 4:27 PM Subject: Re: [JDBC] Pooled Connections (was Connections with Tomcat 3.2.4 and PostgreSQL 7.1.3) > At 07:30 AM 3/6/2002, Dave Cramer wrote: > >Pooled connections aren't rocket science. There are quite a few > >freely available, poolman for one. > > For what it's worth, I never got Poolman 2.0.4 to work with the JDBC > 7.2 drivers; occasionally and for no reason it would give me spurious > errors on > perfectly good SQL. I posted about it a week or two ago on this list. > I received no replies, and furthermore got no replies from the > author(s) and found little information about it on the net. > > I now use Protomatter (protomatter.sourceforge.net) and have had very > good success with it. It's a more simple implementation, hence, > probably faster and/or more bug free, and the author has been very > talkative and has implemented some enhancements/repairs that I have > suggested/provided. > > Also to back up what Dave said - you never know when and/or even if > the GC is going to collect your connections, so always close them in a > finally block. The beauty of GC is that it's non-deterministic and > allows you to be > sloppy. The horror of GC is that it's non-deterministic and allows you > to be sloppy. > > Cheers, > > Doug > > ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly