File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Connection pooling in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Connection pooling in tomcat" Watch "Connection pooling in tomcat" New topic

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.
<description>Oracle Datasource example</description>

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"
username="scott" password="tiger" maxActive="20" maxIdle="10"

Can any one tell me why is that <resource-ref> needed in the web.xml whn its working even without that code?

jeff rusty
Ranch Hand

Joined: Nov 07, 2006
Posts: 109
do anyone have an answer for this?
I agree. Here's the link:
subject: Connection pooling in tomcat
It's not a secret anymore!