You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Martin Vossler <mv...@adelphia.net> on 2004/12/13 16:01:10 UTC

tomcat connection pooling

Does anyone know if its possible for an Apache Soap service to leverage 
Tomcats database connection pooling features?  Any point in the right 
direction for where to find such information is greatly appreciated.

Re: tomcat connection pooling

Posted by Scott Nichol <sn...@scottnichol.com>.
The answer is "yes".

Tomcat implements the JNDI DataSource interface, as well as the JNDI InitialContext interface required to use this.  The JNDI Resources HOW-TO (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html) describes generally how to configure initialization values in config files, while the JNDI DataSource HOW-TO (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html) gives some specifics for using connection pooling with MySQL and Oracle.

In your code, using connection pooling is quite simple.  To get a connection, you use the DataSource:

Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env"); // all configured resources are here
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle"); // resource from server.xml and web.xml
Connection conn = ds.getConnection();

To avoid leaks, you MUST explicitly close each ResultSet, Statement, and Connection you open.

Note that use of the connection pooling is in no way tied to other J2EE technologies, specifically EJBs.  Your service code runs in the context of a webapp and thus has access to pooling. 

Scott Nichol

Do not send e-mail directly to this e-mail address,
because it is filtered to accept only mail from
specific mail lists.

----- Original Message ----- 
From: "Martin Vossler" <mv...@adelphia.net>
To: <so...@ws.apache.org>
Sent: Monday, December 13, 2004 10:01 AM
Subject: tomcat connection pooling


> Does anyone know if its possible for an Apache Soap service to leverage 
> Tomcats database connection pooling features?  Any point in the right 
> direction for where to find such information is greatly appreciated.
> 

Re: tomcat connection pooling

Posted by Martin Gainty <mg...@hotmail.com>.
Hello Jonathan

1)I have to ask the dumb question
What kind of bean would handle the DB Connection Pooling ???

2)Can we expect any performance degradations since we have the added facade 
layer to get to the DB Pool?

Many Thanks,

Martin-

(cell) 617-852-7822




>
>Hi Martin,
>
>This shouldnt be any different from usual usage.
>
>You should implement pooling in the same may in your biz objkects/beans.  
>soap should juts be used to access the interface stubs of the server side 
>interfacee.g
>
>client interface -------> server interface---------> facade------> java 
>bean using conn pooling
>
>the only difference is that you are using soap to access the methods and 
>not a web page.
>
>Hope this helps.
>
>Jnathan
>
>
>Martin Vossler <mv...@adelphia.net> wrote:
>Does anyone know if its possible for an Apache Soap service to leverage
>Tomcats database connection pooling features? Any point in the right
>direction for where to find such information is greatly appreciated.
>
>
>---------------------------------
>  ALL-NEW Yahoo! Messenger - all new features - even more fun!



Re: tomcat connection pooling

Posted by Jonathan Roberts <j_...@yahoo.co.uk>.
Hi Martin,
 
This shouldnt be any different from usual usage.  
 
You should implement pooling in the same may in your biz objkects/beans.  soap should juts be used to access the interface stubs of the server side interfacee.g
 
client interface -------> server interface---------> facade------> java bean using conn pooling
 
the only difference is that you are using soap to access the methods and not a web page.
 
Hope this helps.
 
Jnathan


Martin Vossler <mv...@adelphia.net> wrote:
Does anyone know if its possible for an Apache Soap service to leverage 
Tomcats database connection pooling features? Any point in the right 
direction for where to find such information is greatly appreciated.

		
---------------------------------
 ALL-NEW Yahoo! Messenger - all new features - even more fun!