| Author |
Connection pooling in tomcat
|
jeff rusty
Ranch Hand
Joined: Nov 07, 2006
Posts: 109
|
|
why is this below code need to be put in to web.xml while creating a datasource using tomcat5.5. <resource-ref> <description>Oracle Datasource example</description> <res-ref-name>jdbc/myoracle</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref> I used the following code and its working even without the above code in my web.xml This is my getConnection() Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup("java:/comp/env"); DataSource ds = (DataSource)envContext.lookup("jdbc/myoracle"); Connection conn = ds.getConnection(); .... In my Servre.xml <Resource name="jdbc/myoracle" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc racle:thin:@127.0.0.1:1521:mysid" username="scott" password="tiger" maxActive="20" maxIdle="10" maxWait="-1"/> Can any one tell me why is that <resource-ref> needed in the web.xml whn its working even without that code? TOMCAT5.5 CREATING DATASOURCE thanks, prem
|
 |
jeff rusty
Ranch Hand
Joined: Nov 07, 2006
Posts: 109
|
|
|
do anyone have an answer for this?
|
 |
 |
|
|
subject: Connection pooling in tomcat
|
|
|