Hi,

To obtain a connection from the connection pool i use the following code (described in the tomcat doc) :
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html


- First of all i describe the pool in my context.xml as a *localDataSource*

- then i make a link in the web.xml like that

<resource-ref>
<description> pool definition </description>
<res-ref-name>mypool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


- And i get my connection in my jsp pages : Context initCtx=new InitialContext(); Context envCtx=(Context) initCtx.lookup("java:comp/env"); DataSource ds=(DataSource) envCtx.lookup("mypool"); Connection con=ds.getConnection();


My pb is that the name of the pool is given three times in three different files :-( How to avoid to give the pool name in web.xml and in my JSP pages ?


How to have data sources that exist *only* in context.xml ?


Thanks a lot -- PM


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to