JNDI with TOMCAT4.0 to CLOUDSCAPE ? need explanation
843835Nov 29 2001 — edited Nov 30 2001Hi All,
I'm using TOMCAT4.0 and Cloudscape.
I got below code 1,2,and 3. When I ran it, I can't look up the cloudscape database ?
(I print out "************** null ***************")
Why? It looks like there is no link between jdbc/books and cloudscape database.
How do we correct it? or what is missing in terms of network connection? Or any value that I have is incorrect?
Thanks,
Paul.
1. web.xml
<resource-ref>
<res-ref-name>jdbc/books</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
2. server.xml
<Resource name="jdbc/books" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/books">
<parameter><name>user</name><value></value></parameter>
<parameter><name>password</name><value></value></parameter>
<parameter><name>driverClassName</name>
<value>COM.cloudscape.core.JDBCDriver</value></parameter>
<parameter><name>driverName</name>
<value>jdbc:cloudscape:rmi:books</value></parameter>
</ResourceParams>
3. cloudscape is running(database is OK) and I ran test.jsp
javax.naming.Context ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/jdbc/books");
if (ds == null)
out.println("************** null ***************");
else
{
javax.sql.Connectin conn = ds.getConnection();
}