RE: javax.naming.NamingException: Cannot create resource instance

2002-07-04 Thread Les Hughes

I think I replied direct to this but just for the benefit of the list...

Sorry, typo on my part, you need commons-collections.jar commons-pool.jar
and commons-dbcp.jar
as well as your classes12.zip (renamed and javax.sql removed) in
$CATALINA_HOME/common/lib


Les

 -Original Message-
 From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Sent: 03 July 2002 13:11
 To: Tomcat Users List (E-mail)
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 
 ok nice to go one step further everytime :).
 
 dowloaded these files thro' the link specified
 commons-collections-2.0.zip
 commons-pool-1.0.zip
 
 I have renamed them to collections.jar and pool.jar.
 
 but where is this commons.jar, as you had mentioned, since i 
 cannot find
 them, neither is it there in the links.
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: Les Hughes [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, July 02, 2002 5:06 AM
 To: 'Vikramjit Singh'; 'Tomcat Users List'
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 
 OK, we're making progress!
 
 commons, pool and collections.jar are available from the 
 jakarta-commons
 download area
 http://jakarta.apache.org/commons
 
 Grab those, try again and let us know how it goes.
 
 Les
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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




RE: javax.naming.NamingException: Cannot create resource instance

2002-07-03 Thread Vikramjit Singh


ok nice to go one step further everytime :).

dowloaded these files thro' the link specified
commons-collections-2.0.zip
commons-pool-1.0.zip

I have renamed them to collections.jar and pool.jar.

but where is this commons.jar, as you had mentioned, since i cannot find
them, neither is it there in the links.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Les Hughes [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 02, 2002 5:06 AM
To: 'Vikramjit Singh'; 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



OK, we're making progress!

commons, pool and collections.jar are available from the jakarta-commons
download area
http://jakarta.apache.org/commons

Grab those, try again and let us know how it goes.

Les

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




RE: javax.naming.NamingException: Cannot create resource instance

2002-07-02 Thread Vikramjit Singh

sorry, for the delay in replying les, am working on a project, shall try
your solution. thanks for the suggestion.

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Les Hughes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 2:19 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Ok, I've had a chance to modify my msql example to work with Oracle. Here's
what I found

1) When using the thin driver, make sure that the SID is actually the SID,
not the TNS name of the service. If you're not sure, open your TNSNames.ora
and look for the service name, it should have a entry (SID = ). Use this
as the SID.
Also try specifying the instance on the connect string as in

jdbc:oracle:thin:myinstance@somehost:1512:mysid

I'm not an oracle DB BTW - sorry if the terminology is wrong.

2) You need to remove the javax.sql.* classes from classes12.zip and rename
to classes12.jar. You also need commons.jar, pool.jar and collections.jar in
your common/lib directory.

Debug. If the driver is loading, the Datasource will be created. When you
hit your JSP, Tomcat will dump Ora errors to stdout. Use
$CATALINA_HOME/bin/catalina.bat run to keep the server running in a console
window to get at this dump.

If you see nothing then you have a classpath/driver not found kind of
problem.

So, try a get it to throw some SQLExceptions - that why we know that you're
at least finding the driver OK.

Keep trying - it does work in the end (honest!)

BTW I'm using TC 4.0.3 LE with JDK 1.4.0-b92 on W2K with classes12.zip
downloaded from OTN yesterday, against Oracle 8i

Les


 -Original Message-
 From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Sent: 27 June 2002 05:54
 To: 'Tomcat Users List'
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 Hi,
 
 Just read a mail from Rick. Thanks to ur advice to remove 
 slash, i removed
 slash and thank god didnt get the error that
 
 javax.naming.NamingException: Cannot create resource instance
 
 Now my jsp page is displayed. Really dont know why it gave 
 error due to
 slash(/).
 
 
 But  one more problem, when i run the code, i dont get any 
 connection, coz
 it says DataSource is null. 
 
 Am posting my code again.
 Here is my code in jsp. 
 
   Context ctx = new InitialContext();
   if(ctx == null ) 
   throw new Exception(Boom - No Context);
 
   DataSource ds = (DataSource) 
 ctx.lookup(java:comp/env/jdbc/ora);
   System.out.println(ds);
   if (ds != null) {
   Connection conn = ds.getConnection();
   
 if(conn != null)  {
   String foo = Got Connection +conn.toString();
 Statement stmt = conn.createStatement();
 ResultSet rst = stmt.executeQuery(select empno, 
 ename from
 emp);
   if(rst.next()) {
   foo=rst.getString(2);
   System.out.println(foo);
   }
 conn.close();
   }
   }
 
 lines in server.xml
 
   Context path=CorpMIS docBase=CorpMIS debug=0 
 reloadable=true
 crossContext=true 
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=CorpMIS_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/ora auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/ora
   parameter
   namefactory/name
   
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
   
   
 parameternamemaxActive/namevalue100/value/parameter
   
 parameternamemaxIdle/namevalue3/value/parameter
 
 parameternamemaxWait/namevalue100/value/parameter
   
 parameternameusername/namevaluescott/value/parameter
   
 parameternamepassword/namevaluetiger/value/parameter
 
   parameter
   
 namedriverClassName/namevalueoracle.jdbc.driver.OracleDr
 iver/value
   /parameter
   parameter
   nameurl/name
   valuejdbc:oracle:thin@eou3:1521:incub/value
   /parameter
   /ResourceParams
 /Context
 
 web.xml
 
 resource-ref
   descriptionOracle Test App/description
   res-ref-namejdbc/ora/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: Les Hughes [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 26, 2002 3:25 AM
 To: 'Tomcat Users List'
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 
 Yet more digging about in CVS Perhaps one of the TC devs 
 can confirm
 this but it seems

RE: javax.naming.NamingException: Cannot create resource instance

2002-07-02 Thread Vikramjit Singh

Hi les,

Hi Les,
Did as you said, deleted all the javax.sql.* files from classes12.zip.
Renamed it to classes12.jar, tomcat is sure throwing out dump of Oracle
driver.
You said i needed these files commons.jar, pool.jar and collections.jar, but
where are they, i cant get them. And again i am getting datasource null.
Could  you mail me, the driver and the required jar files. 
Thanking in advance.

Regards,
Vikram


-Original Message-
From: Les Hughes [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 27, 2002 2:19 AM
To: 'Tomcat Users List'
Subject: RE: javax.naming.NamingException: Cannot create resource
instance



Ok, I've had a chance to modify my msql example to work with Oracle. Here's
what I found

1) When using the thin driver, make sure that the SID is actually the SID,
not the TNS name of the service. If you're not sure, open your TNSNames.ora
and look for the service name, it should have a entry (SID = ). Use this
as the SID.
Also try specifying the instance on the connect string as in

jdbc:oracle:thin:myinstance@somehost:1512:mysid

I'm not an oracle DB BTW - sorry if the terminology is wrong.

2) You need to remove the javax.sql.* classes from classes12.zip and rename
to classes12.jar. You also need commons.jar, pool.jar and collections.jar in
your common/lib directory.

Debug. If the driver is loading, the Datasource will be created. When you
hit your JSP, Tomcat will dump Ora errors to stdout. Use
$CATALINA_HOME/bin/catalina.bat run to keep the server running in a console
window to get at this dump.

If you see nothing then you have a classpath/driver not found kind of
problem.

So, try a get it to throw some SQLExceptions - that why we know that you're
at least finding the driver OK.

Keep trying - it does work in the end (honest!)

BTW I'm using TC 4.0.3 LE with JDK 1.4.0-b92 on W2K with classes12.zip
downloaded from OTN yesterday, against Oracle 8i

Les


 -Original Message-
 From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Sent: 27 June 2002 05:54
 To: 'Tomcat Users List'
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 Hi,
 
 Just read a mail from Rick. Thanks to ur advice to remove 
 slash, i removed
 slash and thank god didnt get the error that
 
 javax.naming.NamingException: Cannot create resource instance
 
 Now my jsp page is displayed. Really dont know why it gave 
 error due to
 slash(/).
 
 
 But  one more problem, when i run the code, i dont get any 
 connection, coz
 it says DataSource is null. 
 
 Am posting my code again.
 Here is my code in jsp. 
 
   Context ctx = new InitialContext();
   if(ctx == null ) 
   throw new Exception(Boom - No Context);
 
   DataSource ds = (DataSource) 
 ctx.lookup(java:comp/env/jdbc/ora);
   System.out.println(ds);
   if (ds != null) {
   Connection conn = ds.getConnection();
   
 if(conn != null)  {
   String foo = Got Connection +conn.toString();
 Statement stmt = conn.createStatement();
 ResultSet rst = stmt.executeQuery(select empno, 
 ename from
 emp);
   if(rst.next()) {
   foo=rst.getString(2);
   System.out.println(foo);
   }
 conn.close();
   }
   }
 
 lines in server.xml
 
   Context path=CorpMIS docBase=CorpMIS debug=0 
 reloadable=true
 crossContext=true 
   Logger className=org.apache.catalina.logger.FileLogger
   prefix=CorpMIS_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/ora auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/ora
   parameter
   namefactory/name
   
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
   
   
 parameternamemaxActive/namevalue100/value/parameter
   
 parameternamemaxIdle/namevalue3/value/parameter
 
 parameternamemaxWait/namevalue100/value/parameter
   
 parameternameusername/namevaluescott/value/parameter
   
 parameternamepassword/namevaluetiger/value/parameter
 
   parameter
   
 namedriverClassName/namevalueoracle.jdbc.driver.OracleDr
 iver/value
   /parameter
   parameter
   nameurl/name
   valuejdbc:oracle:thin@eou3:1521:incub/value
   /parameter
   /ResourceParams
 /Context
 
 web.xml
 
 resource-ref
   descriptionOracle Test App/description
   res-ref-namejdbc/ora/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: Les Hughes [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, June 26, 2002 3:25 AM
 To: 'Tomcat

RE: javax.naming.NamingException: Cannot create resource instance

2002-07-02 Thread Les Hughes


OK, we're making progress!

commons, pool and collections.jar are available from the jakarta-commons
download area
http://jakarta.apache.org/commons

Grab those, try again and let us know how it goes.

Les


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




RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Les Hughes


Not claiming to be an expert in any of this but here are a few thoughts.
Feel free to correct me ;-)

Not sure if this is correct but rename classes12.zip to classes12.jar and
try again - I read somewhere that TC doesn't like loading zips. I could be
wrong though...

Also, I dont think you need both drivername and url - they are synonyms for
the same thing. You're using the thin type 4 driver - do you really need to?
The OCI driver has far better performance.

You can also try specifying the username and password on the connect string
jdbc:oracle:thin:user/password@SID:port

One last thing, the property user or username seems to be driver
specific maybe? Try both and let us know which one works :-)

IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.

Bye,

Les





 -Original Message-
 From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 05:42
 To: 'Tomcat Users List'
 Subject: RE: javax.naming.NamingException: Cannot create resource
 instance
 
 
 hi,
 
 I am using tomcat 4.0.3 and the same problem i am facing 
 though i am using
 Oracle driver i.e. classes12.zip. I have tried the code in the url you
 specified and i am also using tomcat 4.0.3 and jdk1.4.
 
 I get the error
 
 javax.naming.NamingException: Cannot create resource instance
   at
 org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
 sourceFactory.
 java:167
 
 here is what i have written in server.xml.
 
 
   Resource name=jdbc/ora auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/ora
   parameter
   namefactory/name
   
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
   parameter
   nameusername/name
   valuescott/value
   /parameter
   parameter
   namepassword/name
   valuetiger/value
   /parameter
   parameter
   namedriverClassName/name
   valueoracle.jdbc.driver.OracleDriver/value
   /parameter
   parameter
   namedriverName/name
   valuejdbc:oracle:thin:@eou3:1521:incub/value
   /parameter
   parameter
   nameurl/name
   valuejdbc:oracle:thin:@eou3:1521:incub/value
   /parameter
   /ResourceParams
 
 Is the driverName correct. If someone is using classes12.zip 
 could someone
 tell whats the correct settings, if mine is wrong.
 in web.xml have written as told.
 
 the jsp has this
 
 %
 try {
   Context ctx = new InitialContext();
   if(ctx == null ) 
   throw new Exception(Boom - No Context);
 
   DataSource ds = (DataSource) 
 ctx.lookup(java:comp/env/jdbc/ora);
   if (ds != null) {
   Connection conn = ds.getConnection();
   
 if(conn != null)  {
   String foo = Got Connection +conn.toString();
 Statement stmt = conn.createStatement();
 ResultSet rst = stmt.executeQuery(select empno, 
 ename from
 emp);
   if(rst.next()) {
   foo=rst.getString(2);
   }
 conn.close();
   }
   }
 } 
 catch (SQLException E) {  
   out.println(brunable to get connection on ora !); 
   out.println(brSQLException:  + E.getMessage());
   out.println(brSQLState:  + E.getSQLState());
   out.println(brVendorError:  + E.getErrorCode());
 }
 %
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 24, 2002 8:04 AM
 To: Tomcat Users List
 Subject: Re: javax.naming.NamingException: Cannot create resource
 instance
 
 
 Hello Kumar,
 
 Try using the username parameter.
 
 Also, the solution that has worked flawlessly for me is here:
 
 http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2
 
 Note that this is with the new 4.1.x versions of Tomcat.  If you are
 using 4.0.x versions, your mileage may vary.
 
 Jake
 
 Monday, June 24, 2002, 10:00:38 AM, you wrote:
 
 K Hi,
 KCan anyone help me how to configure JDBC DataSource 
 using IBM DB2 as
 the
 K database.I had gone through the solution Generic 
 DataSource Resource
 K Factory Available. JDBC Data Sources. posted by 
 Mr.Anthony Dodd.But
 there
 K the solution was explained using Oracle database.Has anyone tried
 K configuring a DataSource using DB2?
 
 K I'm using IBM DB2  7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
 K Tomcat 4.0.2
 
 K Here are the snippets for server.xml,web.xml and the JVM 
 stack trace:
 
 K server.xml:
 
 K Context path=/test docBase=test debug=0 
 reloadable=true
 K   Resource name=jdbc/myDS type

Re: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Fabio Mengue

Hi,

Les Hughes wrote:

Also, I dont think you need both drivername and url - they are synonyms for
the same thing. 

I think DBCP wants URL to be configured. At least with DB2, if I don't 
configure url on server.xml, I get

Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.net.DB2Driver' for 
connect URL 'null'

on catalina.out.

One last thing, the property user or username seems to be driver
specific maybe? Try both and let us know which one works :-)

I think that DBCP also wants username to be configured. I get

DBCP DataSource configured without a 'username'

on catalina.out

IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.

I still can't make DB2 work. I get

*java.lang.UnsupportedOperationException*

and no catalina.out entry for that.

Lack of documentation from IBM is always my problem :)

See ya,

Fabio.

- 
Fabio Mengue - Centro de Computacao - Unicamp
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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




RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Dave Gibbs

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

-Original Message-
From: Fabio Mengue [mailto:[EMAIL PROTECTED]]
Sent: 25 June 2002 13:35
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hi,

Les Hughes wrote:

Also, I dont think you need both drivername and url - they are synonyms for
the same thing.

I think DBCP wants URL to be configured. At least with DB2, if I don't
configure url on server.xml, I get

Cannot create JDBC driver of class 'COM.ibm.db2.jdbc.net.DB2Driver' for
connect URL 'null'

on catalina.out.

One last thing, the property user or username seems to be driver
specific maybe? Try both and let us know which one works :-)

I think that DBCP also wants username to be configured. I get

DBCP DataSource configured without a 'username'

on catalina.out

IF either of you guys get a functioning DB2 and Oracle setting, could you
mail me them? I'm updating the documentation to include specific examples.

I still can't make DB2 work. I get

*java.lang.UnsupportedOperationException*

and no catalina.out entry for that.

Lack of documentation from IBM is always my problem :)

See ya,

Fabio.

-
Fabio Mengue - Centro de Computacao - Unicamp
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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


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




RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Les Hughes

Sorry that's what I meant. I had similar probs with DBCP and mm.mysql, using
URL and username worked fine. I thought we were talking about Oracle but if
(when) you get DB2 working, can you mail me as I'm writing up all this stuff
for a How-To and have nothing on DB2

Ta,

Les

 -Original Message-
 From: Fabio Mengue [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 13:35
 To: Tomcat Users List
 Subject: Re: javax.naming.NamingException: Cannot create resource
 instance
 
 
 Hi,
 
 Les Hughes wrote:
 
 Also, I dont think you need both drivername and url - they 
 are synonyms for
 the same thing. 
 
 I think DBCP wants URL to be configured. At least with DB2, 
 if I don't 
 configure url on server.xml, I get
 
 Cannot create JDBC driver of class 
 'COM.ibm.db2.jdbc.net.DB2Driver' for 
 connect URL 'null'
 
 on catalina.out.
 
 One last thing, the property user or username seems to be driver
 specific maybe? Try both and let us know which one works :-)
 
 I think that DBCP also wants username to be configured. I get
 
 DBCP DataSource configured without a 'username'
 
 on catalina.out
 
 IF either of you guys get a functioning DB2 and Oracle 
 setting, could you
 mail me them? I'm updating the documentation to include 
 specific examples.
 
 I still can't make DB2 work. I get
 
 *java.lang.UnsupportedOperationException*
 
 and no catalina.out entry for that.
 
 Lack of documentation from IBM is always my problem :)
 
 See ya,
 
 Fabio.
 
 - 
 Fabio Mengue - Centro de Computacao - Unicamp
 [EMAIL PROTECTED]   [EMAIL PROTECTED]
 Quem se mata de trabalhar merece mesmo morrer. - Millor
 
 
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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




Re: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Fabio Mengue

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
namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameternamemaxActive/namevalue10/value/parameter
  
parameternamemaxIdle/namevalue3/value/parameter
  parameternamemaxWait/namevalue100/value/parameter

  
parameternameusername/namevalue/value/parameter   // Get 
this from the application...
  
parameternamepassword/namevalue/value/parameter   // idem
  parameternamedriverClassName/name
   valueCOM.ibm.db2.jdbc.net.DB2Driver/value
  /parameter
  parameternameurl/name
   valuejdbc: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
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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




RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Dave Gibbs

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:[EMAIL PROTECTED]]
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
namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameternamemaxActive/namevalue10/value/parameter

parameternamemaxIdle/namevalue3/value/parameter
  parameternamemaxWait/namevalue100/value/parameter


parameternameusername/namevalue/value/parameter   // Get
this from the application...

parameternamepassword/namevalue/value/parameter   // idem
  parameternamedriverClassName/name
   valueCOM.ibm.db2.jdbc.net.DB2Driver/value
  /parameter
  parameternameurl/name
   valuejdbc: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
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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


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




RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Les Hughes


I tried this same blank username and password when doing the mysql stuff and
it too blew up. Does it work if you put the username and password in the
server.xml file?

I also tried putting the username and password on the URL and that blew up
tooOh and not setting a password at the database end (ie create a user
with no password) and not putting a password in the server.xml also made it
blow up.

Fun fun fun eh?


 -Original Message-
 From: Fabio Mengue [mailto:[EMAIL PROTECTED]]
 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
 namefactory/name
 
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   
 parameternamemaxActive/namevalue10/value/parameter
   
 parameternamemaxIdle/namevalue3/value/parameter
   
 parameternamemaxWait/namevalue100/value/parameter
 
   
 parameternameusername/namevalue/value/parameter   // Get 
 this from the application...
   
 parameternamepassword/namevalue/value/parameter   // idem
   parameternamedriverClassName/name
valueCOM.ibm.db2.jdbc.net.DB2Driver/value
   /parameter
   parameternameurl/name

 valuejdbc: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
 [EMAIL PROTECTED]   [EMAIL PROTECTED]
 Quem se mata de trabalhar merece mesmo morrer. - Millor
 
 
 
 
 --
 To unsubscribe, e-mail:   
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]

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




Re: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Manolo Ramirez

I got the same problem with PostgreSQL, it was because the RPM of Tomcat 4.0.3 
does not support Tyrex, I had to compile the source RPM and install all the 
requirements to work.

To verify try loading this Classes:

import tyrex.jdbc.ServerDataSource;
import tyrex.jdbc.xa.EnabledDataSource;

if don't load you must to recompile Tomcat.


-- 
Manolo G. Ramirez T.
Serinbol S.A.

On Mar 25 Jun 2002 00:42, Vikramjit Singh wrote:
 hi,

 I am using tomcat 4.0.3 and the same problem i am facing though i am using
 Oracle driver i.e. classes12.zip. I have tried the code in the url you
 specified and i am also using tomcat 4.0.3 and jdk1.4.

 I get the error

 javax.naming.NamingException: Cannot create resource instance
   at
 org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory
. java:167

 here is what i have written in server.xml.


   Resource name=jdbc/ora auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/ora
   parameter
   namefactory/name

 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
   parameter
   nameusername/name
   valuescott/value
   /parameter
   parameter
   namepassword/name
   valuetiger/value
   /parameter
   parameter
   namedriverClassName/name
   valueoracle.jdbc.driver.OracleDriver/value
   /parameter
   parameter
   namedriverName/name
   valuejdbc:oracle:thin:@eou3:1521:incub/value
   /parameter
   parameter
   nameurl/name
   valuejdbc:oracle:thin:@eou3:1521:incub/value
   /parameter
   /ResourceParams

 Is the driverName correct. If someone is using classes12.zip could someone
 tell whats the correct settings, if mine is wrong.
 in web.xml have written as told.

 the jsp has this

 %
 try {
   Context ctx = new InitialContext();
   if(ctx == null )
   throw new Exception(Boom - No Context);

   DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/ora);
   if (ds != null) {
   Connection conn = ds.getConnection();

 if(conn != null)  {
   String foo = Got Connection +conn.toString();
 Statement stmt = conn.createStatement();
 ResultSet rst = stmt.executeQuery(select empno, ename from
 emp);
   if(rst.next()) {
   foo=rst.getString(2);
   }
 conn.close();
   }
   }
 }
 catch (SQLException E) {
   out.println(brunable to get connection on ora !);
   out.println(brSQLException:  + E.getMessage());
   out.println(brSQLState:  + E.getSQLState());
   out.println(brVendorError:  + E.getErrorCode());
 }
 %

 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031


 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
 Sent: Monday, June 24, 2002 8:04 AM
 To: Tomcat Users List
 Subject: Re: javax.naming.NamingException: Cannot create resource
 instance


 Hello Kumar,

 Try using the username parameter.

 Also, the solution that has worked flawlessly for me is here:

 http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2

 Note that this is with the new 4.1.x versions of Tomcat.  If you are
 using 4.0.x versions, your mileage may vary.

 Jake

 Monday, June 24, 2002, 10:00:38 AM, you wrote:

 K Hi,
 KCan anyone help me how to configure JDBC DataSource using IBM DB2 as
 the
 K database.I had gone through the solution Generic DataSource Resource
 K Factory Available. JDBC Data Sources. posted by Mr.Anthony Dodd.But
 there
 K the solution was explained using Oracle database.Has anyone tried
 K configuring a DataSource using DB2?

 K I'm using IBM DB2  7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
 K Tomcat 4.0.2

 K Here are the snippets for server.xml,web.xml and the JVM stack trace:

 K server.xml:

 K Context path=/test docBase=test debug=0 reloadable=true
 K   Resource name=jdbc/myDS type=COM.ibm.db2.jdbc.DB2DataSource
 K reloadable=true auth=Container/
 K   ResourceParams name=jdbc/myDS
 Kparameter
 K namefactory/name
 K valueorg.apache.naming.factory.DataSourceFactory/value
 K/parameter
 KParameter
 K nameuser/name
 K valuedb2admin/value
 K/Parameter
 KParameter
 K namepassword/name
 K valuedb2admin/value
 K/Parameter
 KParameter
 K namedriverClassName/name
 K valueCOM.ibm.db2.jdbc.app.DB2Driver/value
 K/Parameter
 KParameter
 K namedriverName/name
 K valuejdbc:db2:sample/value
 K/Parameter
 K   /ResourceParams

 K   Realm  className=org.apache.catalina.realm.JDBCRealm
 K  connectionName=db2admin
 K  connectionPassword=db2admin

RE: javax.naming.NamingException: Cannot create resource instance

2002-06-25 Thread Les Hughes

But if you're using dbcp then you're not using tyrex right? I'm using the
LE version of TC 4 which doesn't ship with tyrex anyway (does the RPM?).
And from my understanding tyrex doesn't pool (it provides a single
connection).


 -Original Message-
 From: Manolo Ramirez [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 16:21
 To: Tomcat Users List
 Subject: Re: javax.naming.NamingException: Cannot create resource
 instance
 
 
 I got the same problem with PostgreSQL, it was because the 
 RPM of Tomcat 4.0.3 
 does not support Tyrex, I had to compile the source RPM and 
 install all the 
 requirements to work.
 
 To verify try loading this Classes:
 
 import tyrex.jdbc.ServerDataSource;
 import tyrex.jdbc.xa.EnabledDataSource;
 
 if don't load you must to recompile Tomcat.
 
 
 -- 
 Manolo G. Ramirez T.
 Serinbol S.A.
 
 On Mar 25 Jun 2002 00:42, Vikramjit Singh wrote:
  hi,
 
  I am using tomcat 4.0.3 and the same problem i am facing 
 though i am using
  Oracle driver i.e. classes12.zip. I have tried the code in 
 the url you
  specified and i am also using tomcat 4.0.3 and jdk1.4.
 
  I get the error
 
  javax.naming.NamingException: Cannot create resource instance
  at
  
 org.apache.naming.factory.ResourceFactory.getObjectInstance(Re
 sourceFactory
 . java:167
 
  here is what i have written in server.xml.
 
 
  Resource name=jdbc/ora auth=Container
  type=javax.sql.DataSource/
  ResourceParams name=jdbc/ora
  parameter
  namefactory/name
 
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
  parameter
  nameusername/name
  valuescott/value
  /parameter
  parameter
  namepassword/name
  valuetiger/value
  /parameter
  parameter
  namedriverClassName/name
  valueoracle.jdbc.driver.OracleDriver/value
  /parameter
  parameter
  namedriverName/name
  valuejdbc:oracle:thin:@eou3:1521:incub/value
  /parameter
  parameter
  nameurl/name
  valuejdbc:oracle:thin:@eou3:1521:incub/value
  /parameter
  /ResourceParams
 
  Is the driverName correct. If someone is using 
 classes12.zip could someone
  tell whats the correct settings, if mine is wrong.
  in web.xml have written as told.
 
  the jsp has this
 
  %
  try {
  Context ctx = new InitialContext();
  if(ctx == null )
  throw new Exception(Boom - No Context);
 
  DataSource ds = (DataSource) 
 ctx.lookup(java:comp/env/jdbc/ora);
  if (ds != null) {
  Connection conn = ds.getConnection();
 
  if(conn != null)  {
  String foo = Got Connection +conn.toString();
  Statement stmt = conn.createStatement();
  ResultSet rst = stmt.executeQuery(select 
 empno, ename from
  emp);
  if(rst.next()) {
  foo=rst.getString(2);
  }
  conn.close();
  }
  }
  }
  catch (SQLException E) {
  out.println(brunable to get connection on ora !);
  out.println(brSQLException:  + E.getMessage());
  out.println(brSQLState:  + E.getSQLState());
  out.println(brVendorError:  + E.getErrorCode());
  }
  %
 
  Regards,
  Vikramjit Singh,
  Systems Engineer,
  GTL Ltd.
  Ph. 7612929-1031
 
 
  -Original Message-
  From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
  Sent: Monday, June 24, 2002 8:04 AM
  To: Tomcat Users List
  Subject: Re: javax.naming.NamingException: Cannot create resource
  instance
 
 
  Hello Kumar,
 
  Try using the username parameter.
 
  Also, the solution that has worked flawlessly for me is here:
 
  http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2
 
  Note that this is with the new 4.1.x versions of Tomcat.  If you are
  using 4.0.x versions, your mileage may vary.
 
  Jake
 
  Monday, June 24, 2002, 10:00:38 AM, you wrote:
 
  K Hi,
  KCan anyone help me how to configure JDBC DataSource 
 using IBM DB2 as
  the
  K database.I had gone through the solution Generic 
 DataSource Resource
  K Factory Available. JDBC Data Sources. posted by 
 Mr.Anthony Dodd.But
  there
  K the solution was explained using Oracle database.Has anyone tried
  K configuring a DataSource using DB2?
 
  K I'm using IBM DB2  7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
  K Tomcat 4.0.2
 
  K Here are the snippets for server.xml,web.xml and the JVM 
 stack trace:
 
  K server.xml:
 
  K Context path=/test docBase=test debug=0 
 reloadable=true
  K   Resource name=jdbc/myDS 
 type=COM.ibm.db2.jdbc.DB2DataSource
  K reloadable=true auth=Container/
  K   ResourceParams name=jdbc/myDS
  Kparameter
  K namefactory/name
  K valueorg.apache.naming.factory.DataSourceFactory/value
  K

Re: javax.naming.NamingException: Cannot create resource instance

2002-06-24 Thread Jacob Kjome

Hello Kumar,

Try using the username parameter.

Also, the solution that has worked flawlessly for me is here:

http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2

Note that this is with the new 4.1.x versions of Tomcat.  If you are
using 4.0.x versions, your mileage may vary.

Jake

Monday, June 24, 2002, 10:00:38 AM, you wrote:

K Hi,
KCan anyone help me how to configure JDBC DataSource using IBM DB2 as the
K database.I had gone through the solution Generic DataSource Resource
K Factory Available. JDBC Data Sources. posted by Mr.Anthony Dodd.But there
K the solution was explained using Oracle database.Has anyone tried
K configuring a DataSource using DB2?

K I'm using IBM DB2  7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K Tomcat 4.0.2

K Here are the snippets for server.xml,web.xml and the JVM stack trace:

K server.xml:

K Context path=/test docBase=test debug=0 reloadable=true
K   Resource name=jdbc/myDS type=COM.ibm.db2.jdbc.DB2DataSource
K reloadable=true auth=Container/
K   ResourceParams name=jdbc/myDS
Kparameter
K namefactory/name
K valueorg.apache.naming.factory.DataSourceFactory/value
K/parameter
KParameter
K nameuser/name
K valuedb2admin/value
K/Parameter
KParameter
K namepassword/name
K valuedb2admin/value
K/Parameter
KParameter
K namedriverClassName/name
K valueCOM.ibm.db2.jdbc.app.DB2Driver/value
K/Parameter
KParameter
K namedriverName/name
K valuejdbc:db2:sample/value
K/Parameter
K   /ResourceParams

K   Realm  className=org.apache.catalina.realm.JDBCRealm
K  connectionName=db2admin
K  connectionPassword=db2admin
K  connectionURL=jdbc:db2:sample
K  digest=SHA
K  driverName=COM.ibm.db2.jdbc.app.DB2Driver
K  roleNameCol=role_name
K  userCredCol=password
K  userNameCol=user_name
K  userRoleTable=user_roles
K  userTable=users /
K  /Context

K web.xml:

K  resource-ref
K   descriptionDS resource factory/description
K   res-ref-namejdbc/myDS/res-ref-name
K   res-typeCOM.ibm.db2.jdbc.DB2DataSource/res-type
K   res-authContainer/res-auth
K  /resource-ref

K I get the following error when i try to lookup the datasource in my JSP:
K ctx (java:comp/env) = org.apache.naming.NamingContext@42a80d
K obj = myDS: org.apache.naming.ResourceRef
K Error processing the request (doGet)  : Cannot create resource instance
K javax.naming.NamingException: Cannot create resource instance
K at org.apache.naming.NamingContext.lookup(NamingContext.java:837)
K at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
K at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
K at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
K at CheckDBServlet.doGet(CheckDBServlet.java:40)
K at javax.servlet.http.HttpServlet.service(HttpServlet.java:1125)
K at javax.servlet.http.HttpServlet.service(HttpServlet.java:1264)
K at
K org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
K FilterChain.java:247)
K at
K org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
K ain.java:193)
K at
K org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
K va:243)
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 66)
K at
K org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K at
K org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K at
K org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
K va:215)
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 66)
K at
K org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
K .java:472)
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 64)
K at
K org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K at
K org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K at
K org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2366)
K at
K org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164
K )
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 66)
K at
K org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:462)
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 64)
K at
K org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
K at
K org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
K at
K org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
K :163)
K at
K org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
K 66)

RE: javax.naming.NamingException: Cannot create resource instance

2002-06-24 Thread Vikramjit Singh

hi,

I am using tomcat 4.0.3 and the same problem i am facing though i am using
Oracle driver i.e. classes12.zip. I have tried the code in the url you
specified and i am also using tomcat 4.0.3 and jdk1.4.

I get the error

javax.naming.NamingException: Cannot create resource instance
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.
java:167

here is what i have written in server.xml.


Resource name=jdbc/ora auth=Container
type=javax.sql.DataSource/
ResourceParams name=jdbc/ora
parameter
namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
parameter
nameusername/name
valuescott/value
/parameter
parameter
namepassword/name
valuetiger/value
/parameter
parameter
namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
/parameter
parameter
namedriverName/name
valuejdbc:oracle:thin:@eou3:1521:incub/value
/parameter
parameter
nameurl/name
valuejdbc:oracle:thin:@eou3:1521:incub/value
/parameter
/ResourceParams

Is the driverName correct. If someone is using classes12.zip could someone
tell whats the correct settings, if mine is wrong.
in web.xml have written as told.

the jsp has this

%
try {
Context ctx = new InitialContext();
if(ctx == null ) 
throw new Exception(Boom - No Context);

DataSource ds = (DataSource) ctx.lookup(java:comp/env/jdbc/ora);
if (ds != null) {
Connection conn = ds.getConnection();
  
if(conn != null)  {
String foo = Got Connection +conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery(select empno, ename from
emp);
if(rst.next()) {
foo=rst.getString(2);
}
conn.close();
}
}
} 
catch (SQLException E) {
out.println(brunable to get connection on ora !); 
out.println(brSQLException:  + E.getMessage());
out.println(brSQLState:  + E.getSQLState());
out.println(brVendorError:  + E.getErrorCode());
}
%

Regards,
Vikramjit Singh,
Systems Engineer,
GTL Ltd.
Ph. 7612929-1031


-Original Message-
From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 24, 2002 8:04 AM
To: Tomcat Users List
Subject: Re: javax.naming.NamingException: Cannot create resource
instance


Hello Kumar,

Try using the username parameter.

Also, the solution that has worked flawlessly for me is here:

http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2

Note that this is with the new 4.1.x versions of Tomcat.  If you are
using 4.0.x versions, your mileage may vary.

Jake

Monday, June 24, 2002, 10:00:38 AM, you wrote:

K Hi,
KCan anyone help me how to configure JDBC DataSource using IBM DB2 as
the
K database.I had gone through the solution Generic DataSource Resource
K Factory Available. JDBC Data Sources. posted by Mr.Anthony Dodd.But
there
K the solution was explained using Oracle database.Has anyone tried
K configuring a DataSource using DB2?

K I'm using IBM DB2  7.1 (Driver - COM.ibm.db2.jdbc.app.DB2Driver)
K Tomcat 4.0.2

K Here are the snippets for server.xml,web.xml and the JVM stack trace:

K server.xml:

K Context path=/test docBase=test debug=0 reloadable=true
K   Resource name=jdbc/myDS type=COM.ibm.db2.jdbc.DB2DataSource
K reloadable=true auth=Container/
K   ResourceParams name=jdbc/myDS
Kparameter
K namefactory/name
K valueorg.apache.naming.factory.DataSourceFactory/value
K/parameter
KParameter
K nameuser/name
K valuedb2admin/value
K/Parameter
KParameter
K namepassword/name
K valuedb2admin/value
K/Parameter
KParameter
K namedriverClassName/name
K valueCOM.ibm.db2.jdbc.app.DB2Driver/value
K/Parameter
KParameter
K namedriverName/name
K valuejdbc:db2:sample/value
K/Parameter
K   /ResourceParams

K   Realm  className=org.apache.catalina.realm.JDBCRealm
K  connectionName=db2admin
K  connectionPassword=db2admin
K  connectionURL=jdbc:db2:sample
K  digest=SHA
K  driverName=COM.ibm.db2.jdbc.app.DB2Driver
K  roleNameCol=role_name
K  userCredCol=password
K  userNameCol=user_name
K  userRoleTable=user_roles
K  userTable=users /
K  /Context

K web.xml:

K  resource-ref
K   descriptionDS resource factory/description
K   res-ref-namejdbc/myDS/res-ref-name
K   res-typeCOM.ibm.db2.jdbc.DB2DataSource/res-type
K   res