Niraj,
1. The declaration in the server.xml is malformed. You have two
ResourceParams sections and no Resource section. Follow the how-to for the
correct form.
2. You are declaring a global datasource and need to add a resource link to
the context section of your app. Look in the manager.xml for an example.
3. I am not certain, in that I use MySQL, but do you need to specify a
database name? If so the add it to the end of the URL. The hypersonic site
should have the correct syntax for this.
4. Try a DriverManager type connection to confirm that all else is right
with the world. Simply, if it won't work, nothing will make the DBCP work.
Doug
www.parsonstechnical.com
----- Original Message -----
From: "Niraj Alok" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, March 19, 2004 1:03 AM
Subject: configure hypersonic
Hi All,
This is my first post in this wonderful group and I am really looking
forward to some helpful inputs...
I have a hypersonic database which I created using JBoss 3 and I want my
Tomcat 5 to access this.
My first question is Can i bundle my hypersonic database with my application
in some way that the client who is running Tomcat can access it?
My second question is related to obtaining the connection using DataSource
in Tomcat5 .
I get the following error :
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of
class '' for connect URL 'null', cause:
java.sql.SQLException: No suitable driver
My source code is :
Context ctx = new InitialContext();
if (ctx == null)
throw new Exception("No context got! Exception");
System.out.println("got ctx");
DataSource ds =
(DataSource) ctx.lookup("java:comp/env/jdbc/hypersonic");
if(ds == null)
throw new Exception("No ds got! Exception");
else
{
System.out.println("got ds");
Connection con = ds.getConnection();
if(con != null)
....
...
}
My server.xml looks like :
<GlobalNamingResources>
<!-- Test entry for demonstration purposes -->
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved">
</Resource>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<value>200</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<ResourceParams name="hypersonic">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf</value>
</parameter>
</ResourceParams>
<ResourceParams name="jdbc/hypersonic">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>40</value>
</parameter>
<parameter>
<name>password</name>
<value></value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:hsqldb:hsql://localhost:1701</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>org.hsqldb.jdbcDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
My web.xml contains:
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/hypersonic</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Even if i comment this entry in web.xml the error is still the same.
Can any one please tell me what am I doing wrong??
Regards,
Niraj
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]