tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kwok Peng Tuck <>
Subject Re: connection pooling basic help please
Date Mon, 04 Apr 2005 12:24:24 GMT
Krishnakant Mane wrote:

>I refered to the docs in tomcat 5 for connection
>pooling.  the document is pritty comprehencive and I
>understood the server.xml part of it.
>but now I want to know how exactly can I use a
>connection from the pool in my servlet.
>the example in tomcat documentation is on a jsp based
>applicatio.  but I don't understand how I use a pooled
>connection in a servlet.
You use a pooled connection in a simillar manner to a driver managed 
connection, except that you look up a resource (JNDI in this case). In 
your servlet just look up the resource.

>should I initialise the connection in the Init method?
> how and when should I close the connection?
You should close the connection immediately when you are done with it. 
Best not to pass references of them around. You would close them as a 
you would in a driver managed connection, that is Connection.close() ;

>and wat entries in the web.xml file will effect
>connection pooling?
>Please help it is really urgent.
>Send instant messages to your online friends 
>To unsubscribe, e-mail:
>For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message