aspose file tools*
The moose likes Tomcat and the fly likes Tomcat4.1 ConnectionPool ( javax.naming.NameNot Found Exception: Name java: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat4.1 ConnectionPool ( javax.naming.NameNot Found Exception: Name java: " Watch "Tomcat4.1 ConnectionPool ( javax.naming.NameNot Found Exception: Name java: " New topic
Author

Tomcat4.1 ConnectionPool ( javax.naming.NameNot Found Exception: Name java:

partha sarathi
Greenhorn

Joined: Sep 14, 2005
Posts: 1
Hi,

Pls help me how to do Connection pool in Tomcat4.1
I have written following lines in My jsp.
I have all jar files(naming-common.jar,naming-factory.jar,ojdbc14_g.jar,jndi.jar etc..) in tomcat\common\ lib folder
<%@ page import="javax.naming.*"%>
<%@ page import="javax.sql.*"%>
<%@ page import="java.sql.*"%>

<%
Connection conn=null;
Statement stmt=null;

try{
Context initContext = new InitialContext();
Context ctx=(Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)ctx.lookup("jdbc/timeDB");
conn = ds.getConnection();
stmt=conn.createStatement();
}catch(Exception e)
{System.out.println(" exception Created "+e);
}
%>


In server.xml file i added following lines

<Resource name="jdbc/timeDB" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/timeDB">

<parameter><name>maxWait</name><value>5000</value></parameter>
<parameter><name>maxActive</name><value>20</value></parameter>
<parameter><name>password</name><value>xxxxxx</value></parameter>
<parameter><name>url</name><value>jdbc racle:thin:@xxxxxxx:1521:TESTING</value></parameter>
<parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>
<parameter><name>maxIdle</name><value>2</value></parameter>
<parameter><name>username</name><value>xxxxx</value></parameter>
</ResourceParams>

in web.xml i added folllowing lines

<resource-ref>
<description>oracle database</description>
<res-ref-name>jdbc/timeDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<env-entry >
<env-entry-name>data.source.name</env-entry-name >
<env-entry-type>java.lang.String</env-entry-type >
<env-entry-value>jdbc/timeDB</env-entry-value >
</env-entry >

After running JSp , i am getting following errors:
exception Created javax.naming.NameNotFoundException: Name java: is not bound in this Context

Pls help : my Mail id is partha_samantaray@rediffmail.com




Thanx<br />Partha
Rich Walton
Greenhorn

Joined: Sep 16, 2005
Posts: 4
have you got this before your connection pool declaration in server.xml?


replace contextname with your context name

here is mine
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat4.1 ConnectionPool ( javax.naming.NameNot Found Exception: Name java: