tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marot Laurent" <Laurent.Ma...@alliacom.com>
Subject Connection Pooling using JNDI DataSource
Date Wed, 13 Oct 2004 14:32:41 GMT
Hi all,

Could you please confirm me that when using JNDI DataSource described there http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
(just defining the Datasource in your server.xml file and configuring the resource in web.xml)
and adding the code below in every page (or better in a bean) i would get all the DBCP functionalities.


So for instance, each time i'll made a getConnection i will use a connection from the pool
and not creating one.

  
Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();

seems to be too simple to work this way, isn't it  :-)


Thanks

 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message