tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dave Gibbs" <dgi...@agency.com>
Subject RE: javax.naming.NamingException: Cannot create resource instance
Date Tue, 25 Jun 2002 14:15:22 GMT
I hesitate because I'm not sure I recall clearly, I think I got
UnsupportedOperationException before I ran usejdcb2.bat.
I was working with weblogic, about to try with Tomcat.
I think you will need to use the connection pool data source.
I'm about to tuck into all this so I'll let you know if I have any success.
Dave

-----Original Message-----
From: Fabio Mengue [mailto:fabio@ccuec.unicamp.br]
Sent: 25 June 2002 14:57
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hello,

Dave Gibbs wrote:

>DB2 driver does need the URL formatted as follows.
>URL="jdbc:db2:your_db_name"
>
My server.xml entry (this DON'T work)

          <Resource name="jdbc/DataSource" auth="Container"
                   type="javax.sql.DataSource"/>
            <ResourceParams name="jdbc/DataSource">
              <parameter>
                <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
              </parameter>
              <parameter><name>maxActive</name><value>10</value></parameter>

<parameter><name>maxIdle</name><value>30000</value></parameter>
              <parameter><name>maxWait</name><value>100</value></parameter>


<parameter><name>username</name><value></value></parameter>
  // Get
this from the application...

<parameter><name>password</name><value></value></parameter>
  // idem
              <parameter><name>driverClassName</name>
                   <value>COM.ibm.db2.jdbc.net.DB2Driver</value>
              </parameter>
              <parameter><name>url</name>
               <value>jdbc:db2://server.unicamp.br:8088/database</value>
              </parameter>
            </ResourceParams>

>Have you installed the DB2 CAE on the host machine ?
>
Yes. I don't know much about DB2, we have a DBA for that. I'm just the
poor guy trying to make this work :) I can telnet my server on port
8088, I assume that the host is responding.

>also if you want to use JDBC2 you need to build a new db2java.zip by
running
>usejdbc2.bat in Drive:\DB2\java12.
>
The DBA guy done that. In fact, I've got my application working with
COM.ibm.db2.jdbc.app.DB2Driver on one context, got it working with
COM.ibm.db2.jdbc.net.DB2Driver on another, and I'm trying to make it
work with COM.ibm.db2.jdbc.net.DB2Driver and DBCP on another context.
All on the same server and with Tomcat 4.0.4 (did not tried 4.1.x)

To do that, I had to put on TOMCAT/bin/setclasspath.sh

JAVA_OPTS="-Djava.library.path=/home/db2inst1/sqllib/java12/"

and created a TOMCAT/bin/setenv.sh that is a soft link to
DB2/sqllib/db2profile.

When my servlet try to connect to DB2, I get*
java.lang.UnsupportedOperationException*.


There are several things I don't understand. I read that
javax.sql.DataSource is an interface, that has to be implemented by
another class, supplied by the database vendor. I read Les Hughes
examples and comments, and several people have done their configuration
using other classes than javax.sql.DataSource. DB2 has
DB2BaseDataSource, DB2ConnectionPoolDataSource, DB2DataSource and
DB2XADataSource in his db2java.zip, and I did not found any
documentation on them. May I use them directly ? Do I need to use
javax.sql.ConnectionPoolDataSource ? If DBCP just pools general
Connection objects, why do I get UnsupportedOperationException ? Is DB2
driver not JDBC2.0 compliant ? I don't know, so I'm trying option by
option. Until now, no luck (I'm glad that I have time to test this, my
deadline is a couple of months from now).

I think I'll rm -rf Tomcat and start all over again :) Now for the
million dolar question: Dave, did you manage to make DB2 + DBCP work ?
If so, may you send me your server.xml ?

Thanks,

Fabio.

Dave Gibbs wrote:

>DB2 driver does need the URL formatted as follows.
>URL="jdbc:db2:your_db_name"
>Have you installed the DB2 CAE on the host machine ?
>also if you want to use JDBC2 you need to build a new db2java.zip by
running
>usejdbc2.bat in Drive:\DB2\java12.
>Dave


--
Fabio Mengue - Centro de Computacao - Unicamp
fabio@ccuec.unicamp.br       fabio@unicamp.br
"Quem se mata de trabalhar merece mesmo morrer." - Millor




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


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


Mime
View raw message