RE: Urgent help, please!Best practices using Connection Pool
Usually you should return every connection to your Persistence mechanism, you cannot close the connection, because if do that other process won´t use it. > -- > De: Jose Euclides da Silva Junior - > DATAPREVRJ[SMTP:[EMAIL PROTECTED] > Responder:Tomcat Users List > Enviada: quinta-feira, 9 de outubro de 2003 10:26 > Para: '[EMAIL PROTECTED]' > Assunto: Urgent help, please!Best practices using Connection Pool > > Hi gurus, help me please. > i am using DBCP 1.0 to make connection pool avaiable. My question can be > easy: since DBCP 1.0 doesnt create a singleton object ( just a datasource > object), what should i do whenever my sql queries are done? Should i close > the connection after each sql command is completed? But, if i do this, > will > i loose my connection pool facility, so my next sql command will spend > more > time since the connection process ( with the database ) would be started > before the sql running. I really need to improve my database response > time! > Thanks in advance, > Euclides. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] >
RE: Urgent help, please!Best practices using Connection Pool
You should close your pool connection because the pool doesn't close the real connection. this doc can help you : http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html#Random%20Connection%20Closed%20Exceptions Arnaud > -Message d'origine- > De : Jose Euclides da Silva Junior - DATAPREVRJ > [mailto:[EMAIL PROTECTED] > Envoyé : jeudi 9 octobre 2003 15:27 > À : '[EMAIL PROTECTED]' > Objet : Urgent help, please!Best practices using Connection Pool > > > Hi gurus, help me please. > i am using DBCP 1.0 to make connection pool avaiable. My > question can be > easy: since DBCP 1.0 doesnt create a singleton object ( just > a datasource > object), what should i do whenever my sql queries are done? > Should i close > the connection after each sql command is completed? But, if i > do this, will > i loose my connection pool facility, so my next sql command > will spend more > time since the connection process ( with the database ) would > be started > before the sql running. I really need to improve my database > response time! > Thanks in advance, > Euclides. > > > - > 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: Urgent help, please!Best practices using Connection Pool
Hi Jose, the connection that you are served by your data source is a connection wrapper where the close method will not really close the connection, rather it will tell the connection pool that this connection is free and can be put back in the pool. HTH Adam PS I wouldn't flag your email as "urgent" - I doubt it makes much difference to how quickly you get an answer, and often it only serves to put people off from reading your mail at all, simply because it annoys them that you consider your email should have higher priority for some reason than everyone else's. As if everyone is sitting around happily chatting about really non-urgent things. (which they do sometimes, but mostly not). On 10/09/2003 01:18 AM Jose Euclides da Silva Junior - DATAPREVRJ wrote: Hi, i am using DBCP 1.0. My question is simple: since DBCP doesnt create a singleton object ( just a data source object), what should i do whenever my sql queries are done? Should i close the connection after that? But, if i do this, will i loose my connection pool facility, so my next connection time will waste more time... Thanks in advance, Euclides. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 5.0.12 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Urgent help, please!Best practices using Connection Pool
DBCP wraps the connection object. When you call conn.close(); on the connection object given to you by the DataSource.getConnection(); method, it just releases it back into the pool, it dosen't actually close the connection. -- Nathan Christiansen Tahitian Noni International http://www.tahitiannoni.com -Original Message- From: Jose Euclides da Silva Junior - DATAPREVRJ [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 5:19 PM To: '[EMAIL PROTECTED]' Subject: Urgent help, please!Best practices using Connection Pool Hi, i am using DBCP 1.0. My question is simple: since DBCP doesnt create a singleton object ( just a data source object), what should i do whenever my sql queries are done? Should i close the connection after that? But, if i do this, will i loose my connection pool facility, so my next connection time will waste more time... Thanks in advance, Euclides. - 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]