Hi Dilan,

Its there - see the second attribute.
<Resource name="jdbc/MyDB" type="javax.sql.DataSource"
      password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver"
      maxIdle="2" maxWait="5000" username="user"
 
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
      maxActive="4"/> 
 
Regards,
Jitendra Kharche
Geometric Software Solutions Co. Ltd.
Work: +91-20-2290 6351
 
********************************************************************
This e-mail communication and any attachments are privileged and
confidential and intended only for the use of the recipients named
above. If you are not the intended recipient, please do not review,
disclose, disseminate, distribute or copy this e-mail and attachments.
If you have received this communication in error, please notify the
sender immediately by email or telephone at+91-20-22906351.
*********************************************************************

-----Original Message-----
From: Dilan Kelanibandara [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 22, 2006 2:03 PM
To: 'Tomcat Users List'
Subject: RE: Using Datasource for cloudscape

Hi Jithendra
It seems you have missed the type attribute in resource configuration in
server.xml. I have pasted how that part would looks like.
(type="javax.sql.DataSource" this is missing)

=====================================================
<Resource name="jdbc/MyDB" type="javax.sql.DataSource"
      password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver"
      maxIdle="2" maxWait="5000" username="user"
     type="javax.sql.DataSource"
    
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
      maxActive="4"/>

=================================================
Regards,
Dilan

-----Original Message-----
From: Jitendra Kharche [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 22, 2006 9:41 AM
To: Tomcat Users List
Subject: RE: Using Datasource for cloudscape

 
Hi Dilan,

Have you got all the details about my problem.
 
Regards,
Jitendra Kharche

-----Original Message-----
From: Jitendra Kharche [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 21, 2006 4:09 PM
To: Tomcat Users List
Subject: RE: Using Datasource for cloudscape

 
Hi Dilan,

Thanks for helping again.
I had attached files but it seems attachments are not allowed. I am
adding the contets of these files below. To keep the mail size samll I
am removing old contents of the mail. For the sake of clarity I am
putting my problem statement also.

Problem:
I am using Tomcat 5.5.17 and tried running a sample datasource
application having a jsp page (see contents below) using the Cloudscape
database. I have added the driver jar into CATALINA_HOME/common/lib
directory. When I run the jsp I get following exception
WARNING: Unexpected exception resolving reference
java.lang.NoSuchMethodException:
com.ibm.db2j.jdbc.DB2jDataSource.setScope(boolean)
        at java.lang.Class.getMethod(Class.java:1581)
        at
com.ibm.db2j.jdbc.DB2jAbstractDataSource.getObjectInstance(Unknown
Source)
          ........

************************************************************************
********
Contents of file CATALINA_HOME/webapps/myApp/dbdemo.jsp
************************************************************************
********
<%@ page import="javax.sql.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.naming.*" %>
<%      
Connection con = null;
Statement stmt = null;
try {
        Context initContext = new InitialContext();
        Context envContext  =
(Context)initContext.lookup("java:comp/env");
        DataSource ds = (DataSource)envContext.lookup("jdbc/MyDB");
        System.out.println("Got DataSource\n");
        con = ds.getConnection();
        System.out.println("Got Connection\n"); }
catch(java.lang.Exception e) {
        e.printStackTrace();
        System.err.print(e.getClass().getName());
        System.err.println(e.getMessage());
}

try {
        stmt = con.createStatement();   
        ResultSet rs = stmt.executeQuery("SELECT * FROM employee");
        System.out.println("Table assignment after insertion:");
        %>
        Your table contains the following entries:<BR>
        <table>
        
<tr><B><th>emp_id</th><th>emp_name</th><th>emp_dept</th></B></tr>
        <%
        while (rs.next()) {
                String emp_id = rs.getString("emp_id");
                String emp_name  = rs.getString("emp_name");
                String emp_dept = rs.getString("emp_dept");
        %>
        <tr>
        
<td><%=emp_id%></td><td><%=emp_name%></td><td><%=emp_dept%></td>
        </tr>
        </table>
        <%
        }
        rs.close(); stmt.close(); con.close();
}
catch(java.lang.Exception e) {
        e.printStackTrace();
}%>

************************************************************************
********
Contents of file CATALINA_HOME/conf/server.xml
************************************************************************
********
<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/
>
  <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"
/>
  <Listener
className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer"
value="30"/>
    <Resource auth="Container"
      description="User database that can be updated and saved"
      name="UserDatabase" type="org.apache.catalina.UserDatabase"
      pathname="conf/tomcat-users.xml"
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
    <Resource name="jdbc/MyDB" type="javax.sql.DataSource"
      password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver"
      maxIdle="2" maxWait="5000" username="user"
 
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
      maxActive="4"/>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector port="8080" redirectPort="8443" minSpareThreads="25"
        connectionTimeout="20000" maxSpareThreads="75" maxThreads="150">
    </Connector>
    <Connector port="8009" redirectPort="8443" protocol="AJP/1.3">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host appBase="webapps" name="localhost">
      </Host>
    </Engine>
  </Service>
</Server>

************************************************************************
********
Contents of file CATALINA_HOME/webapps/myApp/WEB-INF/web.xml
************************************************************************
********
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.4"
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";>
        <display-name>
        datasourcedemo</display-name>
        <welcome-file-list>
                <welcome-file>index.html</welcome-file>
                <welcome-file>index.htm</welcome-file>
                <welcome-file>index.jsp</welcome-file>
                <welcome-file>default.html</welcome-file>
                <welcome-file>default.htm</welcome-file>
                <welcome-file>default.jsp</welcome-file>
        </welcome-file-list>

        <resource-ref>
                <res-ref-name>jdbc/MyDB</res-ref-name>
                <res-type>javax.sql.DataSource</res-type>
                <res-auth>Container</res-auth>
        </resource-ref>
</web-app>

************************************************************************
********
Contents of file CATALINA_HOME/webapps/myApp/META-INF/context.xml
************************************************************************
********
<?xml version="1.0" encoding="UTF-8"?>
<Context>
  <Resource auth="Container" name="jdbc/MyDB"
type="com.ibm.db2j.jdbc.DB2jDataSource"
    password="password" driverClassName="com.ibm.db2j.jdbc.DB2jDriver"
    factory="com.ibm.db2j.jdbc.DB2jConnectionPoolDataSource"
    maxIdle="4" testOnBorrow="true" validationQuery="select 1"
username="user"
 
url="jdbc:db2j:E:/apache-tomcat-5.5.17/webapps/datasourcedemo/SampleDB"
    timeBetweenEvictionRunsMillis="30000" maxActive="8"/> </Context>
 
Regards,
Jitendra Kharche


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe,
e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to