Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

Re: Tomcat 5 and oracle

Paul

2003-12-10

Replies:

i have tomcat4 running with Oracle8i with jdk1.4.  Because it is jdk 1.4,
need to use the oracle9i drivers to access the oracle8i db. I use the
following two drivers, obtained from Oracle, which work fine:

ojdbc14.jar
ocrs12.jar

i think your problem is more likely to do with server.xml, placement and/or
content:

do you define your contexts explicitly in your server.xml file?

-paul.

----- Original Message -----
From: "John Sidney-Woollett" <johnsw@(protected)>
To: "Jonathan Drnek" <Jonathan.Drnek@(protected)>
Cc: <tomcat-user@(protected)>
Sent: Wednesday, December 10, 2003 12:25 PM
Subject: Re: Tomcat 5 and oracle


> Try using the thin driver - it's jar file is classes12.jar
>
> Place it in [TOMCAT_HOME]/common/lib
>
> John Sidney-Woollett
>
> Jonathan Drnek said:
> > I am having a problem setting up a data source in tomcat. I seem to
> > remember having this problem last time I played with it several moths
> > ago but I don't remember what I did to fix it.
> >
> > I am running Tomcat 5.0.16 with JVM version 1.4.2_03-b02 on windows
> > 2000.
> >
> > I am trying to connect to an Oracle 8.1.7.1.0 database.
> >
> > I have placed the ojdbc14.jar file in common\lib
> >
> > The error I am getting is
> >
> > javax.servlet.ServletException: Cannot create JDBC driver of class ''
> > for connect URL 'null', cause: No suitable driver
> >
> > I am using oracle.jdbc.driver.OracleDriver because that's what the docs
> > said, but I seem to recall that was not correct. I just can't find
> > anything that tells me what other driver I should be using.
> >
> >
> > My server.xml file has
> >
> > .
> > .
> > .
> > <Resource name="jdbc/ordt" type="javax.sql.DataSource"/>
> > .
> > .
> > .
> > </ResourceParams>
> >  <ResourceParams name="jdbc/ordt">
> >     <parameter>
> >      <name>validationQuery</name>
> >      <value>select * from dual</value>
> >     </parameter>
> >     <parameter>
> >      <name>url</name>
> >      <value>jdbc:oracle:thin:@(protected)>
> >     </parameter>
> >     <parameter>
> >      <name>password</name>
> >      <value>password</value>
> >     </parameter>
> >     <parameter>
> >      <name>maxActive</name>
> >      <value>4</value>
> >     </parameter>
> >     <parameter>
> >      <name>maxWait</name>
> >      <value>5000</value>
> >     </parameter>
> >     <parameter>
> >      <name>driverClassName</name>
> >      <value>oracle.jdbc.driver.OracleDriver</value>
> >     </parameter>
> >     <parameter>
> >      <name>username</name>
> >      <value>username</value>
> >     </parameter>
> >     <parameter>
> >      <name>maxIdle</name>
> >      <value>2</value>
> >     </parameter>
> > </ResourceParams>
> > .
> > .
> > .
> >
> > web.xml looks like
> >
> > <?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>
> >  <display-name>Metrology Lab</display-name>
> >  <description>
> >    First Source Metrology Lab
> >  </description>
> >
> > <resource-ref>
> > <description>Oracle Datasource example</description>
> > <res-ref-name>jdbc/ordt</res-ref-name>
> > <res-type>javax.sql.DataSource</res-type>
> > <res-auth>Container</res-auth>
> > </resource-ref>
> >
> > </web-app>
> >
> > my code looks like
> >
> >         Context initContext = new InitialContext();
> >         Context envContext
> > (Context)initContext.lookup("java:/comp/env");
> >         DataSource ds = (DataSource)envContext.lookup("jdbc/ordt");
> >         Connection conn = ds.getConnection();
> >
> > Thanks for any help,
> >
> > Jon Drnek
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
> For additional commands, e-mail: tomcat-user-help@(protected)
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)



©2008 junlu.com - Jax Systems, LLC, U.S.A.