You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andoni <an...@indigo.ie> on 2003/03/19 13:57:43 UTC

Oracle - JNDI - Pooling - classes12.zip

Hello,

Could someone please post a chunck of their server.xml and web.xml where
they are using tomcat 4.0 and classes12.jar and Oracle and have successfully
implemented connection pooling.

I have a huge history of postings to this group and many questions on this
subject but no right answers!

Otherwise a few answers to questions will also help:

1. Are Tyrex & classes12.jar mutually exclusive (i.e. do they do the same
job, the both implement DataSource.class)?

2. In the <name>driverName</name><value>?</value>  Should this be the full
connection URL?

Please help as I am going demented and the documentation is v. vague.

Andoni.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Oracle - JNDI - Pooling - classes12.zip

Posted by Chad Perry <ch...@hotmail.com>.
Oracle Database and Tomcat 4.1.8 JNDI connection pooling notes. (still
refining)

I recently needed to grab data from a Oracle 9i DB from tomcat 4.1.18. While
I was seting it up, I created some notes that I think may help you and/or
others on this list.  Note, I'm still refining these notes, because I will
be doing this many more time in the near future.

Oracle 9i and Tomcat 4.1.18 JNDI setup points: (added a few 8i differences
also)

1)     Oracle 9i works with ojdbc14.jar. Oracle 8i used classes12.jar.
(Note: must use a JAR extention not a zip!)
2)     The location to place the Oracle specific JAR (see above) in Tomcat
4.x is C:\jakarta-tomcat-4.1.18\common\lib\* (again this needs to be a JAR
not a ZIP file)
3)     A common mistake is to place the <Resource/> and  <ResourceParams/>
server.xml elements either in the wrong <context/> element or not in one at
all. This will produce an Exception similar to: java.sql.SQLException:
Cannot load JDBC driver class 'null'

Note:
I have seen people say you should Use
oracle.jdbc.pool.OracleConnectionPoolDataSource instead of
oracle.jdbc.driver.OracleDriver for the driverClassName parameter inside the
server.xml configuration file. For example:

<parameter>
   <name>driverClassName</name>
   <value>oracle.jdbc.pool.OracleConnectionPoolDataSource</value>
</parameter>

But both seem to work for me? So I’m still investigating.




MISC links to other helpful Oracle JNDI setup info:
http://forum.java.sun.com/thread.jsp?forum=48&thread=267528
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
to.html


Example of the required server.xml configuration:

                <Context path="/goldendata" docBase="goldendata" debug="0"
                 reloadable="true" crossContext="true">

                  <!-- #############  DATASOURCE  #############-->
                  <Resource name="jdbc/GoldenDB" auth="Container"
type="javax.sql.DataSource"/>

                  <ResourceParams name="jdbc/GoldenDB">
                    <parameter>
                      <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                    </parameter>

                    <parameter>
                      <name>driverClassName</name>
                      <!--<value>oracle.jdbc.driver.OracleDriver</value>-->

<value>oracle.jdbc.pool.OracleConnectionPoolDataSource</value>
                    </parameter>

                    <parameter>
               <name>url</name>
                      <value>jdbc:oracle:thin:@localhost:1521:TestDB</value>
             </parameter>


                    <parameter>
                      <name>username</name>
                      <value>spaz</value>
                    </parameter>
                    <parameter>
                      <name>password</name>
                      <value>shhhh</value>
                    </parameter>
                    <!--<parameter>
                      <name>driverName</name>
                      <value>jdbc:oracle:thin:@localhost:1521:TestDB</value>
                    </parameter> -->

                    <parameter>
                      <name>maxActive</name>
                      <value>20</value>
                    </parameter>
                    <parameter>
                      <name>maxIdle</name>
                      <value>10</value>
                    </parameter>
                    <parameter>
                      <name>maxWait</name>
                      <value>-1</value>
             </parameter>

                  </ResourceParams>
                  <!-- #######################################-->
     </Context>





Example of using this Oracle 8-9i connection pool inside your Java source co
de:

       Context initContext = new InitialContext();
       Context envContext  = (Context)initContext.lookup("java:/comp/env");
       DataSource ds = (DataSource)envContext.lookup("jdbc/GoldenDB");
       Connection conn = ds.getConnection();
----- Original Message -----
From: "Andoni" <an...@indigo.ie>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Wednesday, March 19, 2003 4:57 AM
Subject: Oracle - JNDI - Pooling - classes12.zip


> Hello,
>
> Could someone please post a chunck of their server.xml and web.xml where
> they are using tomcat 4.0 and classes12.jar and Oracle and have
successfully
> implemented connection pooling.
>
> I have a huge history of postings to this group and many questions on this
> subject but no right answers!
>
> Otherwise a few answers to questions will also help:
>
> 1. Are Tyrex & classes12.jar mutually exclusive (i.e. do they do the same
> job, the both implement DataSource.class)?
>
> 2. In the <name>driverName</name><value>?</value>  Should this be the full
> connection URL?
>
> Please help as I am going demented and the documentation is v. vague.
>
> Andoni.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Oracle - JNDI - Pooling - classes12.zip

Posted by Peter Lin <tc...@yahoo.com>.
I think I've mentioned this before.  In the sample
webapp I posted, it includes a stand alone class that
uses classes12.zip and a jsp version using a bean. It
may not be exactly what you're looking for, but it
does work with tomcat 4.1.19

peter


--- Andoni <an...@indigo.ie> wrote:
> Hello,
> 
> Could someone please post a chunck of their
> server.xml and web.xml where
> they are using tomcat 4.0 and classes12.jar and
> Oracle and have successfully
> implemented connection pooling.
> 
> I have a huge history of postings to this group and
> many questions on this
> subject but no right answers!
> 
> Otherwise a few answers to questions will also help:
> 
> 1. Are Tyrex & classes12.jar mutually exclusive
> (i.e. do they do the same
> job, the both implement DataSource.class)?
> 
> 2. In the <name>driverName</name><value>?</value> 
> Should this be the full
> connection URL?
> 
> Please help as I am going demented and the
> documentation is v. vague.
> 
> Andoni.
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
> tomcat-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org