• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

unable to implement connection pooling with sybase

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,
i am trying to implement connection pooling with sybase as the database and tomcat 5 as the container. But this is the exception thats coming :

javax.naming.NameNotFoundException: Name jdbc/TestDB2 is not bound in
this Context

My server.xml looks lilke this :
<Context path="/DBTest2" docBase="DBTest2" debug="5" reloadable="true" crossContext="true" >

<Logger classname="org.apache.catalina.logger.FileLogger"
prefix="localhost_DBTest2_log." suffix=".txt" timestamp="true" />

<Resource name="jdbc/TestDB2" auth="Container" type="javax.sql.DataSource" />

<ResourceParams name="jdbc/TestDB2">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>

<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>

<parameter>
<name>username</name>
<value>sa</value>
</parameter>

<parameter>
<name>password</name>
<value></value>
</parameter>

<parameter>
<name>driverClassName</name>
<value>com.sybase.jdbc2.jdbc.SybDriver</value>
</parameter>

<parameter>
<name>url</name>
<value>jdbc:sybase:Tds:172.16.12.84:2048/lnk_common_dd</value>
</parameter>

</ResourceParams>

</Context>

This is my web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>MySQL Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB2</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>


this is my test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<sql:query var="rs" dataSource="jdbc/TestDB2">
select id, foo, bar from testdata
</sql:query>

<html>
<head>
<title>DB Test</title>
</head>
<body>

<h2>Results</h2>

<c:forEach var="row" items="${rs.rows}">
Foo ${row.foo}<br/>
Bar ${row.bar}<br/>
</c:forEach>

</body>
</html>

Any help would be much appreciated as i am stuck with this since the last 2 days

thanking you all in advance

Bhavani
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!