Vickie,

1. Look for an error in the server.xml. When you moved the context section
you may have left out or added in something that messes up the format of the
file. Use a viewer like IE to look at the file and see what is wrong.

2. Check your log and if nothing shows up the turn up debugging.

3. Move the username entry to before the password entry. I had a problem
with it not seeing the password.

Doug
www.parsonstechnical.com


----- Original Message ----- 
From: "Cooper, Vickie" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, May 12, 2004 7:32 PM
Subject: RE: Trying to connect to DB2 usning JNDI


I moved the context around the resource:
<Context debug="0" docBase="C:/Program Files/Apache Group/Tomcat
4.1/webapps/vickie.war" path="/vickie" reloadable="false"
useNaming="true">

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

    <ResourceParams name="jdbc/DB2">
     <parameter>
       <name>factory</name>
       <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>mypass</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:db2:DB2</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>myuserid</value>
      </parameter>
    </ResourceParams>
  </Context>

Now when I start up the server, I get an error:
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unkno
wn Source)...

When I try to run the servlet, I now get this error:
SQLException caught: Cannot create JDBC driver of class '' for connect
URL 'null'

Any ideas?

Thanks,

Vickie

-----Original Message-----
From: Mike Curwen [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 12, 2004 1:25 PM
To: 'Tomcat Users List'
Subject: RE: Trying to connect to DB2 usning JNDI


Is the Resource outside or inside your Context ?
It should be inside.



> -----Original Message-----
> From: Cooper, Vickie [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 12, 2004 3:04 PM
> To: [EMAIL PROTECTED]
> Subject: Trying to connect to DB2 usning JNDI
>
>
> I have been trying to connect to DB2 but I keep getting the error:
> javax.naming.NameNotFoundException: Name jdbc is not bound in
> this Context at org.apache.naming.NamingContext.lookup
> My code has:
>   Context initCtx =3D new InitialContext();
>   Context envCtx =3D (Context)initCtx.lookup("java:comp/env");
>   DataSource ds =3D (DataSource)envCtx.lookup("jdbc/DB2");
>
> My server.xml has:
> <Resource name=3D"jdbc/DB2" auth=3D"Container" =
> type=3D"javax.sql.DataSource"/> <ResourceParams name=3D"jdbc/DB2">
>      <parameter>
>        <name>factory</name>
>        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>       </parameter>
>       <parameter>
>         <name>maxWait</name>
>         <value>5000</value>
>       </parameter>
>       <parameter>
>         <name>maxActive</name>
>         <value>4</value>
>       </parameter>
>       <parameter>
>         <name>password</name>
>         <value>mypass</value>
>       </parameter>
>       <parameter>
>         <name>url</name>
>         <value>jdbc:db2:DB2</value>
>       </parameter>
>       <parameter>
>         <name>driverClassName</name>
>         <value>COM.ibm.db2.jdbc.app.DB2Driver</value>
>       </parameter>
>       <parameter>
>         <name>maxIdle</name>
>         <value>2</value>
>       </parameter>
>       <parameter>
>         <name>username</name>
>         <value>myuser</value>
>       </parameter>
>     </ResourceParams>
>        <Context className=3D"org.apache.catalina.core.StandardContext"
> cachingAllowed=3D"true"
> charsetMapperClass=3D"org.apache.catalina.util.CharsetMapper"
> cookies=3D"true" crossContext=3D"false" debug=3D"0" =
> docBase=3D"C:/Program Files/Apache Group/Tomcat
> 4.1/webapps/vickie.war"
> mapperClass=3D"org.apache.catalina.core.StandardContextMapper"
> path=3D"/vickie" privileged=3D"false" reloadable=3D"false"
> swallowOutput=3D"false" useNaming=3D"true"
> wrapperClass=3D"org.apache.catalina.core.StandardWrapper">
>         </Context>
>
> I added this to my web.xml:
> <web-app>
>    <resource-ref>
>       <res-ref-name>jdbc/DB2</res-ref-name>
>       <res-type>javax.sql.DataSource</res-type>
>       <res-auth>Container</res-auth>
>    </resource-ref>
>
> I can't find anything wrong...but it won't connect.  I'm
> using the DB2Client on my pc to connect to the db2 data.
> This works when I connect with Jrun, so it should be able to
> find it.  It also works if I
> use:
> Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
> String url=3D  "jdbc:db2:DB2";
>
> I have copied the db2java.zip to /tomcat/common/lib and
> renamed it to db2java.jar
>
> Any ideas why this won't connect?  Is there any way to test
> the connection for TomCat outside of a servlet...just to
> verify it can get there?
>
> Thanks,
>
> Vickie
>
>
> Vickie Cooper
> OS/390 Web Services & FOCUS/EDA Technical Support
> Phone:  (425) 957-5502
> Email:   [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to