RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-04 Thread Les Hughes


The model is very simple and as a coder you never see that DBCP is there
instead of Tyrex or a direct connection.

Let me know how you get on an I'll patch the documentation accordingly. Also
I noticed that my howto has made it into CVS (thanks guys!) so if you grab a
nightly build (probably tomorrow now) then you can follow those
instructions.

Good luck!

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-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: plain MySQL DataSource in Tomcat (i know, damn topic)

2002-07-04 Thread Les Hughes

Hiya,

My understanding is that the default pool was tyrex which has been dropped
in favour of dbcp in more recent TC builds - I'm not sure when this happened
but the docs have def. changed recently.

Also, the tyrex pool isnt really a pool from what I can gather and some
impls seem to have a hard coded ref to the hqsl driver  - I never managed to
get tyrex to work which is why I favour DBCP (read: I got it working)

Clay - I'm not that familiar with Struts but I'd guess that JNDI datasources
are more standard than the struts way? Not sure But if you get a good
solution using JNDI can you let me know and I'll patch it onto the end of
the JNDI datasources example doc thats hust made it into CVS :-)

Les



 -Original Message-
 From: Clay Graham [mailto:[EMAIL PROTECTED]]
 Sent: 03 July 2002 05:28
 To: 'Tomcat Users List'
 Subject: RE: plain MySQL DataSource in Tomcat (i know, damn topic)
 
 
 Cindy,
 
 you rock and are very helpful...I had great success using the STRUTS 
 pooling, so I am a little disappointed that isn't working for 
 me right 
 now
 
 does anyone know if the STRUTS pool is better than the new 
 JNDI pools, or 
 worse?
 
 just fishing
 
 LOVE YOU ALL!
 
 clay
 
 
 -Original Message-
 From: Cindy Ballreich [SMTP:[EMAIL PROTECTED]]
 Sent: Tuesday, July 02, 2002 11:28 AM
 To:   Tomcat Users List
 Subject:  RE: plain MySQL DataSource in Tomcat (i know, 
 damn topic)
 
 Hi Clay,
 
 It's a small net. I hope you are well!!
 
 I haven't tried using Struts yet, but I've been thinking 
 about checking it 
 out.
 
 I did try the JNDI/DBCP method described at the URL you 
 posted and it does 
 work and it seemed to be pooling correctly. However, the 
 connection times 
 out after a while which is a real pain. I haven't had time to 
 figure out 
 what's going on with that and work out fix for it yet. Also, 
 DBCP seems a 
 little immature to me at this point, so I'll probably wait a 
 little while 
 and try that again.
 
 I also tried the JNDI/Tyrex setup and was able to get a 
 connection, but I 
 couldn't tell if it was pooling properly and I ran into some 
 bugs with 
 Tyrex so I abandoned that approach.
 
 I've been using DbConnectionBroker using a set up similar to 
 that described 
 in Bergsten's Java Server Pages book. The connection is 
 stable and the 
 pooling is working well. I don't know how much of a load this 
 will handle, 
 but for the time being it's allowing me to concentrate on 
 other things. I'd 
 much rather be using JNDI, but I think that this is the most stable 
 approach going right now.
 
 I hope this is at least a little bit helpful.
 
 Hang in there
 
 Cindy
 (sorry for the top post)
 
 At 08:33 AM 7/2/02 -0700, Clay Graham wrote:
 Are alot of people having problems with the mySql drivers or 
 am I being
 myopic...
 
 i tried to do this with STRUTS datasource pooling and had 
 the following
 issues...
 
 I am asking a question because I am very suprised at an unexepected
 behaviour and thought that someone may have a hint.
 
 I have linux 7.1 tomcat 404 ant struts 102 working and they have been
 tested, and I am taking the next step by starting to connect 
 to my MySql
 database, all goodness.
 
 So my first step was to add the datasource in my struts-config.xml as
 follows:
 
 data-sources
   data-source
 set-property property=autoCommit
   value=false/
 set-property property=description
   value=The Test Datasource/
 set-property property=driverClass
   value=org.gjt.mm.mysql.Driver/
 set-property property=maxCount
   value=4/
 set-property property=minCount
   value=2/
 set-property property=password
   value=/
 set-property property=url
   value=jdbc:mysql://localhost/test/
 set-property property=user
   value=root/
   /data-source
 /data-sources
 
 the next step was to add the mm.mysql-2.0.6.1.jar to my project's
 WEB-INF/lib directory, the standard approach
 
 [clay@meis test]$ jar -tvf test.war|grep mm.mysql
 390333 Sun Jun 30 16:20:20 PDT 2002 WEB-INF/lib/mm.mysql-2.0.6.1.jar
 
 I am sure this JAR has the mysql driver in it:
 
 [clay@meis test]$ jar -tvf web/WEB-INF/lib/mm.mysql-2.0.6.1.jar |grep
 Driver
  15163 Sat Jun 16 09:20:28 PDT 2001
 mm.mysql-2.0.6/org/gjt/mm/mysql/Driver.java
   5443 Sat Jun 16 09:20:28 PDT 2001
 mm.mysql-2.0.6/org/gjt/mm/mysql/Driver.class
 
 so when I install the application using ant the following 
 error occurs:
 
 - Root Cause -
 java.sql.SQLException: open: java.lang.ClassNotFoundException:
 org.gjt.mm.mysql.Driver
 
 I have even put mm.mysql-2.0.6.1.jar in tomcat/common/lib 
 and it does not
 find the driver. I am asking this question on this list 
 because it happens 
 in struts-config.xml
 
 so now I am looking into going over to the JNDI approach 
 

RE: Connection Pooling?

2002-07-04 Thread Les Hughes

I think I should set up a cron job to email this link out every day

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



 -Original Message-
 From: Meichun Li [mailto:[EMAIL PROTECTED]]
 Sent: 04 July 2002 13:09
 To: Tomcat Users List
 Subject: Connection Pooling?
 
 
 Hi,
 I want to implement my application with Connection Pooling.  
 
 Tomcat offers supports of a connection pool for JDBC 
 connection, but there 
 should be a prerequisite--JDBC driver should provide pooled 
 datasource 
 implementation. Is this right?
 
 The JDBC driver for MySQL database I am using is 
 org.gjt.mm.mysql. The 
 driver has the class MysqlDataSource that is a JNDI DataSource for
 Mysql JDBC connection-- only the basic
 implementation of javax.sql.Datasource but not connection pool 
 implementation.
 
 Is this means that I can't  use connection pool with this 
 JDBC driver in 
 tomcat?
 
 Thanks!
 
 Meichun
 
 
 -- 
 Meichun Li
 Ibiblio.org
 919-962-5646
 
 
 --
 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: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Two things,

In your server.xml
user I think should be username
and
driverName has been deprecated in favour of url which needs the servername
and DB name as well
(as in something like jdbc:postgresql://full.server.name/mybookdb - or
whatever the DB is called)

Are you *sure* you're using the right install of TC and that the server.xml
has no reference to the hsql driver?

BTW - only got this working with Oracle and mySQL so most of this is
guesswork based on those two exercises. 

Bye,

Les
P.S. You shouldn't open the connection in init() nor cache the connection
BTW - use a pool instead :)

 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 11:09
 To: 'Tomcat Users List'
 Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Hi
 
 I've just started to write servlets. Servlets that only do 
 processing, without 
 connecting to database work fine, but I have some problems to get the 
 connection with postgresql via jdbc work.
 
 Tomcat: 4.0.4 (on linux)
 Postgresql: 7.2.1 (on linux)
 Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)
 
 The servlet is quite simple:
 
 import java.io.*;
 import java.util.*;
 import java.sql.*;
 import javax.sql.*;
 import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 public class InfoServlet extends HttpServlet {
 
 Connection con;
 private boolean conFree = true;
 
 public void init() throws ServletException {
 try  {
 Context initCtx = new InitialContext();
 Context envCtx = 
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)
 envCtx.lookup(jdbc/BookDB);
 Connection con = ds.getConnection();
 } catch (Exception ex) {
 throw new ServletException(Couldn't 
 open connection 
 to database:  + ex.getMessage());
 }
 }
 
 public void destroy() {
 try {
 con.close();
 } catch (SQLException ex) {
 System.out.println(ex.getMessage());
 }
 }
 
 public void doGet (HttpServletRequest request, 
 HttpServletResponse 
 response) throws ServletException, IOException {
 
 HttpSession session = request.getSession();
 
 // set content-type header before accessing the Writer
 response.setContentType(text/html);
 response.setBufferSize(8192);
 PrintWriter out = response.getWriter();
 
 // then write the data of the response
 out.println(html +
 headtitleDuke's Bookstore/title/head);
 }
 }
 
 in web/WEB-INF/web.xml I defined:
 
 
 !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-nameCurrency Converter Application/display-name
 description
 Test servlet
 /description
 servlet
 servlet-nameinfo/servlet-name
 display-nameinfo/display-name
 descriptionno description/description
 servlet-classInfoServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-nameinfo/servlet-name
 url-pattern/info/url-pattern
 /servlet-mapping
 session-config
 session-timeout30/session-timeout
 /session-config
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 /web-app
 
 And in server.xml in the contex of the application:
 
Context path=/bookstore docBase=bookstore debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_bookstore_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/BookDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/BookDB
 parameter
   nameuser/name
   valuejava/value
 /parameter
 parameter
   namepassword/name
   valuejava/value
 /parameter
 parameter
   namedriverClassName/name
   valueorg.postgresql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:postgresql:public/value
 /parameter
   /ResourceParams
 /Context
 
 I've tried a few different driverName parameters: (restarting 
 Tomcat after 
 each change)
 jdbc:postgresql://localhost/public
 

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: Error with Oracle Jdbc

2002-07-02 Thread Les Hughes

If you're using a client install of oracle instead of the thin drivers (I'm
guessing because of your @TOMCATDB syntax) then the url is
jdbc:oracle:oci8:user/passwd@TNSname ie

jdbc:oracle:oci8:spifdogg/spifdogg@TOMCATDB
or
jdbc:oracle:oci8:@TOMCATDB and passs the user and password into the
getConnection call.

But for any non-trival system, you should be using a connection pool (search
the archives for a HowTo)

Les

 -Original Message-
 From: Vikramjit Singh [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 05:43
 To: 'Tomcat Users List'
 Subject: RE: Error with Oracle Jdbc
 
 
 the url which i use is like this
 
 DriverManager.getConnection(jdbc:oracle:thin:@ServerName:1521:SID,
 USERNAME, PASSWORD);
 
 Regards,
 Vikramjit Singh,
 Systems Engineer,
 GTL Ltd.
 Ph. 7612929-1031
 
 
 -Original Message-
 From: William Gustave [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 01, 2002 9:37 PM
 To: TOMCAT USER
 Subject: Error with Oracle Jdbc
 Importance: High
 
 
 I am getting the following Error from my app when I hit the 
 index.jsp page.
 Can somebody help me it would be greatly appreciated.
 
  jdbc java.sql.SQLException: Invalid Oracle URL specified
 
 I am running the following
 Tomcat 4  (It is on the same machine as the Database Server)
 Oracle 8.1
 Oracle8i 8.1.7.1JDBC Drivers (Which I have extracted into
 \tomcat4\webapps\testoracle\WEB-INF\classes directory)
 
 Below is the JSP code that is on the page.
 
 %@ page import=oracle.jdbc.driver.* %
 %@ page import=java.sql.* %
 
 %
 try{
 
 Class.forName(oracle.jdbc.driver.OracleDriver);
 Connection conn =
 DriverManager.getConnection(jdbc:oracle:localhost:@TOMCATDB,
 spifdogg,
 spifdogg);
 Statement statemnt = conn.createStatement();
 
 ResultSet users = statemnt.executeQuery(select * from user);
 
 }catch(Exception e){
   out.println(e);
 }
 %
 
 
 --
 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]

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




RE: plain MySQL DataSource in Tomcat (i know, damn topic)

2002-07-02 Thread Les Hughes


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

:-)


 -Original Message-
 From: Marc Logemann [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 13:35
 To: [EMAIL PROTECTED]
 Subject: plain MySQL DataSource in Tomcat (i know, damn topic)
 
 
 Hi,
 
 i am one of the guys trying to get a valid MysqlDataSource 
 reference via
 JNDI. But i am getting crazy without knowing where the 
 problem is (perhaps
 the reason is, i cant debug JNDI too good, cause i am no 
 expert in it..)
 
 i have the following:
 
 server.xml
 --
 context 
 Resource name=jdbc/TestDB auth=Cotainer 
 type=javax.sql.DataSource/
 ResourceParams name=jdbc/TestDB
 parameter
 namefactory/name
 
 valueorg.gjt.mm.mysql.jdbc2.optional.MysqlDataSourceFactory/value
   /parameter
 parameter nameuser/namevalueroot/value /parameter
 parameter namepassword/namevalue/value /parameter
 parameter 
 namedriverClassName/namevalueorg.gjt.mm.mysql.jdbc2.opti
 onal.MysqlDataSource/value/parameter
 parameter 
 namedriverName/namevaluejdbc:mysql://localhost/maxbahr/
 value /parameter
 /ResourceParams
 /context
 
 web.xml
 ---
 web-app
 resource-ref
   descriptionDataSource MySQL/description
   res-ref-namejdbc/TestDB/res-ref-name
   res-type javax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref
 /web-app
 
 i placed the mysql mm jar into commons/lib
 
 When i run a servlet with the standard lookup code:
  try {
  javax.naming.Context jndictx = new InitialContext();
  if (jndictx == null) throw new Exception(Boom - No 
 Context);
 
  DataSource ds =
  (DataSource) 
 jndictx.lookup(java:comp/env/jdbc/TestDB);
  if (ds != null) {
 [..]
 
 i get no exception but i also dont get any reference returned 
 from lookup.
 
 I read tons of websites including the tomcat JNDI howto, 
 without beeing able to understand it
 better (in fact it gets worse cause of thousands of 
 combinations in the web for server.xml and
 web.xml)
 
 When i leave out factory in the server.xml, i get a tyrex 
 exception regarding loading a factory...
 
 I just thought that using a datasource is better than just 
 calling the DriverManager, but the
 effort seems amazing... or i am too unclever... whatever...
 
 thx for help.
 ---
 greetings from
 Marc Logemann
 Homebase @ www.logemann.info
 
 
 --
 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: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Yep :-)

Oh, I think there's a typo in the URL - remove the two // - this is all
driver specific so it's a case of RTM :-)

 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:00
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 14:53, Przemyslaw Kowalczyk wrote:
 
 I came to another conclusion. Even if there was some 
 reference to hsql driver 
 in my server.xml it shouldn't affect my own servlet, as it 
 uses its own 
 context. Am I right?
 
 przem
 
 
 --
 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: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes

web-app  
  resource-ref
  descriptionDB Connection/description
  res-ref-namejdbc/TestDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
/web-app

The description is missing (but I dont have a DTD to had to tell whether
this is optional) but other than that it's fine.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:00
 To: [EMAIL PROTECTED]
 Subject: RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Is this normal :
 
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 
 More especially : res-authContainter/res-auth : CONTAINTER?
 
 Andre Powroznik
 
 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 12:09
 To: 'Tomcat Users List'
 Subject: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 Hi
 
 I've just started to write servlets. Servlets that only do 
 processing, without 
 connecting to database work fine, but I have some problems to get the 
 connection with postgresql via jdbc work.
 
 Tomcat: 4.0.4 (on linux)
 Postgresql: 7.2.1 (on linux)
 Jdbc: pgjdbc2.jar (from jdbc.postgresql.org)
 
 The servlet is quite simple:
 
 import java.io.*;
 import java.util.*;
 import java.sql.*;
 import javax.sql.*;
 import javax.naming.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
 public class InfoServlet extends HttpServlet {
 
 Connection con;
 private boolean conFree = true;
 
 public void init() throws ServletException {
 try  {
 Context initCtx = new InitialContext();
 Context envCtx = 
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds = (DataSource)
 envCtx.lookup(jdbc/BookDB);
 Connection con = ds.getConnection();
 } catch (Exception ex) {
 throw new ServletException(Couldn't 
 open connection 
 to database:  + ex.getMessage());
 }
 }
 
 public void destroy() {
 try {
 con.close();
 } catch (SQLException ex) {
 System.out.println(ex.getMessage());
 }
 }
 
 public void doGet (HttpServletRequest request, 
 HttpServletResponse 
 response) throws ServletException, IOException {
 
 HttpSession session = request.getSession();
 
 // set content-type header before accessing the Writer
 response.setContentType(text/html);
 response.setBufferSize(8192);
 PrintWriter out = response.getWriter();
 
 // then write the data of the response
 out.println(html +
 headtitleDuke's Bookstore/title/head);
 }
 }
 
 in web/WEB-INF/web.xml I defined:
 
 
 !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-nameCurrency Converter Application/display-name
 description
 Test servlet
 /description
 servlet
 servlet-nameinfo/servlet-name
 display-nameinfo/display-name
 descriptionno description/description
 servlet-classInfoServlet/servlet-class
 /servlet
 servlet-mapping
 servlet-nameinfo/servlet-name
 url-pattern/info/url-pattern
 /servlet-mapping
 session-config
 session-timeout30/session-timeout
 /session-config
 resource-ref
 res-ref-namejdbc/BookDB/res-ref-name
 res-typejavax.sql.DataSource/res-type
 res-authContainter/res-auth
 /resource-ref
 /web-app
 
 And in server.xml in the contex of the application:
 
Context path=/bookstore docBase=bookstore debug=0
  reloadable=true crossContext=true
   Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_bookstore_log. suffix=.txt
   timestamp=true/
   Resource name=jdbc/BookDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/BookDB
 parameter
   nameuser/name
   valuejava/value
 /parameter
 parameter
   namepassword/name
   valuejava/value
 /parameter
 parameter
   namedriverClassName/name
   valueorg.postgresql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:postgresql:public/value
 

RE: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Ignore the remove // comment - I was looking at my oracle notes :-)
I really have no idea why it's trying to load the hsql driver if there's no
ref in your
server.xml

Post your server.xml and web.xml and we'll both have a look.



 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:13
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 15:00, [EMAIL PROTECTED] wrote:
  Is this normal :
 
resource-ref
  res-ref-namejdbc/BookDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainter/res-auth
  /resource-ref
 
  More especially : res-authContainter/res-auth : CONTAINTER?
 
 
 You are right, there is a misseling, but correcting it didn't 
 help much :-(
 
 I'm still curious why tomcat wants a hsql driver even though it's not 
 mentioned in any configuration file.
 
 przem
 
 
 
 
 --
 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: Tomcat 4.0.4, jndi, jdbc and postgresql [long]

2002-07-02 Thread Les Hughes


Ok. Summary time.

Martin reflects my experience - I dumped tyrex and used DBCP as well. But
aren't we trying to go direct without a pool? Having said that I've only
ever managed to get datasources working when DBCP is being used...

Check that your driver jarfile does not contain the javax.sql extension
classes. If it does, delete them and rejar. Some versions of Tomcat will
ignore any jar that has these classes present. Be careful with this thought
- I work with jdk1.4 which has these built in.

Also, you don't specify a DataSourceFactory in your server.xml - see below.


Here's a known (well as far as I know...) good postgres solution using DBCP.
See
http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2
for my original mysql post as well.



Resource name=jdbc/postgres auth=Container
  type=javax.sql.DataSource/ 

ResourceParams name=jdbc/postgres
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
namedriverClassName/name
valueorg.postgresql.Driver/value
  /parameter
  parameter
nameurl/name
valuejdbc:postgresql://127.0.0.1:5432/mydb/value
  /parameter
  parameter
nameusername/name
valuemyuser/value
  /parameter
  parameter
namepassword/name
valuemypasswd/value
  /parameter
  parameter
namemaxActive/name
value20/value
  /parameter
  parameter
namemaxIdle/name
value10/value
  /parameter
  parameter
namemaxWait/name
value-1/value
  /parameter
/ResourceParams 




 -Original Message-
 From: Przemyslaw Kowalczyk [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2002 14:53
 To: Tomcat Users List
 Subject: Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
 
 
 On Tuesday 02 July 2002 15:43, [EMAIL PROTECTED] wrote:
  Do you have already connected to a postgresql db using a 
 java app? Are you
  sure the parameters are correct? What is public? Where 
 did you put the
  postgresql.jar?
 
 Yes, without any problems from 'standalone' application. I'm 
 able to query and 
 update database, so parameters (url, username and password) are ok.
 
 There is no postgresql.jar, only pgjdbc2.jar. I put it in 
 ${tomcat-root}/lib 
 directory.  I tried first to add a link named postgresql.jar 
 and then I've 
 renamed it but it didn't help :-(
 
  Do you have a file named hsql.jar? Can you remove it?
 
 I don't have such file.
 
 
 przem
 
 
 --
 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


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 

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: tomcat won't load oracle driver

2002-06-25 Thread Les Hughes

Isnt classes111.zip for 1.1 VMs and classes12.zip for 1.2/1.3 VMs (Can't
comment on 1.4)? Also, I think the rename to .jar and stick em in common/lib
for TC4 (not sure where on TC3) will help. 

 -Original Message-
 From: Marius Schwarz [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 14:02
 To: Tomcat Users List
 Subject: Re: tomcat won't load oracle driver
 
 
 Am 23-Jun-02 schrieb Keith Wannamaker:
 
  Someone mentioned on -dev that one has to remove the java*.sql
  classes from the oracle jdbc jar in order to work with jdk 1.4
  (since 1.4 began bundling these classes as well)
 he could extract them and place them in his classpath, that 
 has to work.
 
 Gruss
 -- 
 Ihr POWER-NETZ®-Team
 
  POWER-NETZ®
 Full-Service-Provider 
 
 Service Tel:  01805 - 57 35 57 (DM 0,24/Min.)
 Service Fax: 01805 - 57 45 57 (DM 0,24/Min.)
 
 Online-Support:
 Support: 0190 - 15 11 15 (DM 1,21/Min)
 #http://Support.Power-Netz.de# (kostenlos)
 #http://Support.Power-Netz.com# (kostenlos)
 
 
 Power-Netz
 Reeperbahn 157
 20359 Hamburg
 
 #http://www.Power-Netz.de#
 #mailto:[EMAIL PROTECTED]#
 
 
 +=+
 --I N F O   C E N T E R--
 + Senden Sie eine leere e-mail an:
 + Providerwechsel: #mailto:[EMAIL PROTECTED]#
 + Daten/Preise Webspace: #mailto:[EMAIL PROTECTED]#
 + Reseller-Programm: #mailto:[EMAIL PROTECTED]#
 + Dedizierte Server: #mailto:[EMAIL PROTECTED]#
 + Adult/Erotikserver: #mailto:[EMAIL PROTECTED]#
 + Domainpreise: #mailto:[EMAIL PROTECTED]#
 + WebDesign: #mailto:[EMAIL PROTECTED]#
 + SSL-Zertifikate: #mailto:[EMAIL PROTECTED]#
 + Online-Datenbanken: #mailto:[EMAIL PROTECTED]#
 + Geschaeftsbedingungen: #mailto:[EMAIL PROTECTED]#
 + =+
 
 
 
 --
 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: tomcat won't load oracle driver

2002-06-25 Thread Les Hughes

OTN has classes12.zip for jdk1.2 and classes111.zip for jdk 1.1 for 8i, and
classes12.zip for jdk1.2/1.3 and ojdbc14.jar for jdk1.4 for 9i.

So, no 1.4 support for 8i and no 1.1 support for 9i it seems.

Take your pick :-) But I still think that TC needs .jar and not .zip
files

Oh and I'm not a expert in any of this either BTW...

Les

 -Original Message-
 From: Andy Eastham [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 14:27
 To: Tomcat Users List
 Subject: RE: tomcat won't load oracle driver
 
 
 I think the problem ,ay be that 1.4 uses jdbc v3.  The oracle drivers
 probably have require jdbc v2 hardcoded in them.  I 
 remember this being
 the case for a particular set of drivers, though I'm not 
 absolutely sure it
 was Oracle.  Are there any new ones from Oracle?
 
 Andy
 
  -Original Message-
  From: Les Hughes [mailto:[EMAIL PROTECTED]]
  Sent: 25 June 2002 14:17
  To: 'Tomcat Users List'
  Subject: RE: tomcat won't load oracle driver
 
 
  Isnt classes111.zip for 1.1 VMs and classes12.zip for 
 1.2/1.3 VMs (Can't
  comment on 1.4)? Also, I think the rename to .jar and stick em in
  common/lib
  for TC4 (not sure where on TC3) will help.
 
   -Original Message-
   From: Marius Schwarz [mailto:[EMAIL PROTECTED]]
   Sent: 25 June 2002 14:02
   To: Tomcat Users List
   Subject: Re: tomcat won't load oracle driver
  
  
   Am 23-Jun-02 schrieb Keith Wannamaker:
  
Someone mentioned on -dev that one has to remove the java*.sql
classes from the oracle jdbc jar in order to work with jdk 1.4
(since 1.4 began bundling these classes as well)
   he could extract them and place them in his classpath, that
   has to work.
  
   Gruss
   --
   Ihr POWER-NETZ®-Team
  
POWER-NETZ®
   Full-Service-Provider 
  
   Service Tel:  01805 - 57 35 57 (DM 0,24/Min.)
   Service Fax: 01805 - 57 45 57 (DM 0,24/Min.)
  
   Online-Support:
   Support: 0190 - 15 11 15 (DM 1,21/Min)
   #http://Support.Power-Netz.de# (kostenlos)
   #http://Support.Power-Netz.com# (kostenlos)
  
  
   Power-Netz
   Reeperbahn 157
   20359 Hamburg
  
   #http://www.Power-Netz.de#
   #mailto:[EMAIL PROTECTED]#
  
  
   +=+
   --I N F O   C E N T E R--
   + Senden Sie eine leere e-mail an:
   + Providerwechsel: #mailto:[EMAIL PROTECTED]#
   + Daten/Preise Webspace: #mailto:[EMAIL PROTECTED]#
   + Reseller-Programm: #mailto:[EMAIL PROTECTED]#
   + Dedizierte Server: #mailto:[EMAIL PROTECTED]#
   + Adult/Erotikserver: #mailto:[EMAIL PROTECTED]#
   + Domainpreise: #mailto:[EMAIL PROTECTED]#
   + WebDesign: #mailto:[EMAIL PROTECTED]#
   + SSL-Zertifikate: #mailto:[EMAIL PROTECTED]#
   + Online-Datenbanken: #mailto:[EMAIL PROTECTED]#
   + Geschaeftsbedingungen: #mailto:[EMAIL PROTECTED]#
   + =+
  
  
  
   --
   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]
 
 
 
 
 --
 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: tomcat won't load oracle driver

2002-06-25 Thread Les Hughes

oops, didn't scroll - there is a version of classes11.zip for 9isilly
me...

 -Original Message-
 From: Les Hughes [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 14:52
 To: 'Tomcat Users List'
 Subject: RE: tomcat won't load oracle driver
 
 
 OTN has classes12.zip for jdk1.2 and classes111.zip for jdk 
 1.1 for 8i, and
 classes12.zip for jdk1.2/1.3 and ojdbc14.jar for jdk1.4 for 9i.
 
 So, no 1.4 support for 8i and no 1.1 support for 9i it seems.
 
 Take your pick :-) But I still think that TC needs .jar and not .zip
 files
 
 Oh and I'm not a expert in any of this either BTW...
 
 Les
 
  -Original Message-
  From: Andy Eastham [mailto:[EMAIL PROTECTED]]
  Sent: 25 June 2002 14:27
  To: Tomcat Users List
  Subject: RE: tomcat won't load oracle driver
  
  
  I think the problem ,ay be that 1.4 uses jdbc v3.  The 
 oracle drivers
  probably have require jdbc v2 hardcoded in them.  I 
  remember this being
  the case for a particular set of drivers, though I'm not 
  absolutely sure it
  was Oracle.  Are there any new ones from Oracle?
  
  Andy
  
   -Original Message-
   From: Les Hughes [mailto:[EMAIL PROTECTED]]
   Sent: 25 June 2002 14:17
   To: 'Tomcat Users List'
   Subject: RE: tomcat won't load oracle driver
  
  
   Isnt classes111.zip for 1.1 VMs and classes12.zip for 
  1.2/1.3 VMs (Can't
   comment on 1.4)? Also, I think the rename to .jar and stick em in
   common/lib
   for TC4 (not sure where on TC3) will help.
  
-Original Message-
From: Marius Schwarz [mailto:[EMAIL PROTECTED]]
Sent: 25 June 2002 14:02
To: Tomcat Users List
Subject: Re: tomcat won't load oracle driver
   
   
Am 23-Jun-02 schrieb Keith Wannamaker:
   
 Someone mentioned on -dev that one has to remove the java*.sql
 classes from the oracle jdbc jar in order to work with jdk 1.4
 (since 1.4 began bundling these classes as well)
he could extract them and place them in his classpath, that
has to work.
   
Gruss
--
Ihr POWER-NETZ®-Team
   
 POWER-NETZ®
Full-Service-Provider 
   
Service Tel:  01805 - 57 35 57 (DM 0,24/Min.)
Service Fax: 01805 - 57 45 57 (DM 0,24/Min.)
   
Online-Support:
Support: 0190 - 15 11 15 (DM 1,21/Min)
#http://Support.Power-Netz.de# (kostenlos)
#http://Support.Power-Netz.com# (kostenlos)
   
   
Power-Netz
Reeperbahn 157
20359 Hamburg
   
#http://www.Power-Netz.de#
#mailto:[EMAIL PROTECTED]#
   
   
+=+
--I N F O   C E N T E R--
+ Senden Sie eine leere e-mail an:
+ Providerwechsel: #mailto:[EMAIL PROTECTED]#
+ Daten/Preise Webspace: #mailto:[EMAIL PROTECTED]#
+ Reseller-Programm: #mailto:[EMAIL PROTECTED]#
+ Dedizierte Server: #mailto:[EMAIL PROTECTED]#
+ Adult/Erotikserver: #mailto:[EMAIL PROTECTED]#
+ Domainpreise: #mailto:[EMAIL PROTECTED]#
+ WebDesign: #mailto:[EMAIL PROTECTED]#
+ SSL-Zertifikate: #mailto:[EMAIL PROTECTED]#
+ Online-Datenbanken: #mailto:[EMAIL PROTECTED]#
+ Geschaeftsbedingungen: #mailto:[EMAIL PROTECTED]#
+ =+
   
   
   
--
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]
  
  
  
  
  --
  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]
 

--
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 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: Re[2]: tomcat won't load oracle driver

2002-06-25 Thread Les Hughes

Hi Jake,

Thanks for confirming the file rename thing. Are you using a JNDI datasource
or just Class.forName() with the Oracle driver?

Les

 -Original Message-
 From: Jacob Kjome [mailto:[EMAIL PROTECTED]]
 Sent: 25 June 2002 15:59
 To: Tomcat Users List
 Subject: Re[2]: tomcat won't load oracle driver
 
 
 Hello Les,
 
 I run Tomcat 4.1.3 under j2sdk1.4_01 with classes12.zip (renamed to
 .jar with is absolutely required).  I keep it in
 TOMCAT_HOME/common/lib.  I connect to a pretty old Oracle 8 database
 and a newer Oracle 8i database.  Tomcat and Oracle are *not* on the
 same machine.  I have never hand one ounce of trouble with this setup
 on any instance of Tomcat including any version of 3.3.x. and 4.x.x.
 with JDK1.3.x and JDK1.4.x.
 
 Just remember that Tomcat will load any file ending in .jar from the
 lib directories and will ignore any files that don't end it .jar.
 
 Jake
 
 Tuesday, June 25, 2002, 8:52:08 AM, you wrote:
 
 LH OTN has classes12.zip for jdk1.2 and classes111.zip for 
 jdk 1.1 for 8i, and
 LH classes12.zip for jdk1.2/1.3 and ojdbc14.jar for jdk1.4 for 9i.
 
 LH So, no 1.4 support for 8i and no 1.1 support for 9i it seems.
 
 LH Take your pick :-) But I still think that TC needs .jar 
 and not .zip
 LH files
 
 LH Oh and I'm not a expert in any of this either BTW...
 
 LH Les
 
  -Original Message-
  From: Andy Eastham [mailto:[EMAIL PROTECTED]]
  Sent: 25 June 2002 14:27
  To: Tomcat Users List
  Subject: RE: tomcat won't load oracle driver
  
  
  I think the problem ,ay be that 1.4 uses jdbc v3.  The 
 oracle drivers
  probably have require jdbc v2 hardcoded in them.  I 
  remember this being
  the case for a particular set of drivers, though I'm not 
  absolutely sure it
  was Oracle.  Are there any new ones from Oracle?
  
  Andy
  
   -Original Message-
   From: Les Hughes [mailto:[EMAIL PROTECTED]]
   Sent: 25 June 2002 14:17
   To: 'Tomcat Users List'
   Subject: RE: tomcat won't load oracle driver
  
  
   Isnt classes111.zip for 1.1 VMs and classes12.zip for 
  1.2/1.3 VMs (Can't
   comment on 1.4)? Also, I think the rename to .jar and stick em in
   common/lib
   for TC4 (not sure where on TC3) will help.
  
-Original Message-
From: Marius Schwarz [mailto:[EMAIL PROTECTED]]
Sent: 25 June 2002 14:02
To: Tomcat Users List
Subject: Re: tomcat won't load oracle driver
   
   
Am 23-Jun-02 schrieb Keith Wannamaker:
   
 Someone mentioned on -dev that one has to remove the 
 java*.sql
 classes from the oracle jdbc jar in order to work 
 with jdk 1.4
 (since 1.4 began bundling these classes as well)
he could extract them and place them in his classpath, that
has to work.
   
Gruss
--
Ihr POWER-NETZ®-Team
   
 POWER-NETZ®
Full-Service-Provider 
   
Service Tel:  01805 - 57 35 57 (DM 0,24/Min.)
Service Fax: 01805 - 57 45 57 (DM 0,24/Min.)
   
Online-Support:
Support: 0190 - 15 11 15 (DM 1,21/Min)
#http://Support.Power-Netz.de# (kostenlos)
#http://Support.Power-Netz.com# (kostenlos)
   
   
Power-Netz
Reeperbahn 157
20359 Hamburg
   
#http://www.Power-Netz.de#
#mailto:[EMAIL PROTECTED]#
   
   
+=+
--I N F O   C E N T E R--
+ Senden Sie eine leere e-mail an:
+ Providerwechsel: #mailto:[EMAIL PROTECTED]#
+ Daten/Preise Webspace: #mailto:[EMAIL PROTECTED]#
+ Reseller-Programm: #mailto:[EMAIL PROTECTED]#
+ Dedizierte Server: #mailto:[EMAIL PROTECTED]#
+ Adult/Erotikserver: #mailto:[EMAIL PROTECTED]#
+ Domainpreise: #mailto:[EMAIL PROTECTED]#
+ WebDesign: #mailto:[EMAIL PROTECTED]#
+ SSL-Zertifikate: #mailto:[EMAIL PROTECTED]#
+ Online-Datenbanken: #mailto:[EMAIL PROTECTED]#
+ Geschaeftsbedingungen: #mailto:[EMAIL PROTECTED]#
+ =+
   
   
   
--
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]
  
  
  
  
  --
  To unsubscribe, e-mail:   
 LH mailto:[EMAIL PROTECTED]
 LH For additional commands, e-mail:
 LH mailto:[EMAIL PROTECTED]
 
 LH --
 LH To unsubscribe, e-mail:   
 mailto:[EMAIL PROTECTED]
 LH For additional commands, e-mail: 
 mailto:[EMAIL PROTECTED]
 
 
 
 -- 
 Best regards,
  Jacobmailto:[EMAIL PROTECTED]
 
 
 --
 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: Can servlet write to file in /WEB-INF?

2002-06-24 Thread Les Hughes

Hi,

getRealPath() and its ilk are really very evil. If the webapp isn't exploded
into the filesystem - i.e. it's run straight from the war file then you
wont be able to write to the filesystem under WEB-INF anyway. And that's not
addressing *why* a webapp requires filesystem access and the related
security issues of allowing a servlet/jsp to write into a protected area
like WEB-INF either.

Anyway, my 2p says you should be doing something like:-

File temp =
(File)getServletContext().getAttribute(javax.servlet.context.tempdir);  

then make a dir/file under this for your output.

Hope this helps.

Les


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 24 June 2002 09:13
 To: [EMAIL PROTECTED]
 Subject: RE: Can servlet write to file in /WEB-INF?
 
 
 Instead there is a method in the servlet context : 
 getRealPath(String relativefilename) - then you can open a 
 normal fileoutputstream.
 
 -Original Message-
 From: tamir [mailto:[EMAIL PROTECTED]]
 Sent: 24 June 2002 11:31
 To: 'Tomcat Users List'
 Subject: RE: Can servlet write to file in /WEB-INF?
 
 
 Hi,
 Making URLConnection to a directory under WEB-INF, is the 
 same like writing
 this url in the explorer.
 However, You can't go directly to any directory under WEB-INF 
 in that way,
 which justifies your failure of
 writing to this directory.
 
 You can write to files in this directory, if you don't use 
 URLConnection.
 That's what I think
 Tamir
 
 -Original Message-
 From: john-paul delaney [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, June 22, 2002 10:48 AM
 To: TC user list
 Subject: Can servlet write to file in /WEB-INF?
 
 
 I was trying to see if I could write to a file in the 
 /WEB-INF directory but
 I couldn't get it to work - is there a problem with a servlet 
 writing to
 this directory or is it just me (again ;( ) ?
 
 thanks
 /j-p.
 
 URL url = context.getResource(/contextTest.txt);
 URLConnection con = url.openConnection();
 con.setDoOutput(true);
 OutputStream out = con.getOutputStream();
 PrintWriter pw = new PrintWriter(new OutputStreamWriter(out));
 pw.println(foo);
 pw.close();
 out.close();
 
 
 
 ---
  JUSTATEST Art Online
   www.justatest.com
 
 
 
 
 --
 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]
 
  DISCLAIMER  
 This e-mail and any attachments thereto may contain information 
 which is confidential and/or protected by intellectual property 
 rights and are intended for the sole use of the recipient(s) 
 named above. 
 Any use of the information contained herein (including, but 
 not limited to, 
 total or partial reproduction, communication or distribution 
 in any form) 
 by persons other than the designated recipient(s) is prohibited. 
 If you have received this e-mail in error, please notify the 
 sender either 
 by telephone or by e-mail and delete the material from any computer. 
 Thank you for your cooperation.
 
 
 --
 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: Storing Java Objects in SQL

2002-06-15 Thread Les Hughes


Unless you *really* want to serialize objects into BLOBs you should be using
an ORM. I'm playing with Castor which seems to work well with Tomcat 4 -
http://castor.exolab.org but there are others around.


 -Original Message-
 From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]]
 Sent: 13 June 2002 07:06
 To: Tomcat Users List
 Subject: AW: Storing Java Objects in SQL
 
 
 The most driver I know, just support setObject for a given
 set of classes (typically some or all Subclasses of Number, String,
 Date)
 or column types (typicaly no blobs)
 
 To use a portable solution I would serialize the Object to an 
 byte array
 and store it with PreparedStatement.setBytes()
 
 As storing blobs is a quite a pain if you deal with different 
 databases.
 (At least it was, 1 year ago) I prefer to store blobs outside of the 
 database. (To do this, you have to make shure that you don't 
 delete or 
 overwrite the file before the transaction is committed)
 
  -Ursprüngliche Nachricht-
  Von: Paul Kofon [mailto:[EMAIL PROTECTED]]
  Gesendet: Mittwoch, 12. Juni 2002 19:39
  An: [EMAIL PROTECTED]
  Betreff: Storing Java Objects in SQL
  
  
  I'm trying to store objects (instances) of a class in Microsoft SQL
 Server 
  2K using the Microsoft-provided JDBC driver, but I've been 
 without any
 luck 
  thus far.
  I've used the setObject() method in the PreparedStatement class and
 set my 
  target sql type to BINARY, yet it doesn't work, I keep getting an 
  SQLException. 
 
 --
 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: Does Jakarta have a connection pooling project?

2002-06-15 Thread Les Hughes

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

 -Original Message-
 From: anthony.dodd [mailto:[EMAIL PROTECTED]]
 Sent: 15 June 2002 05:46
 To: Tomcat Users List
 Subject: Re: Does Jakarta have a connection pooling project?
 
 
 Hi
 
 I've posted a solution see Generic DataSource Resource Factory
 Available. JDBC Data Source on the tomcat user maillist. See 
 also Updated.
 Generic DataSource Resource Factory. Available. JDBC Data 
 Source , for an
 update to the readme for Pool Oracle connections.
 
 Tony
 
 - Original Message -
 From: John McNally [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Thursday, June 13, 2002 5:35 PM
 Subject: Re: Does Jakarta have a connection pooling project?
 
 
  On Thu, 2002-06-13 at 16:53, [EMAIL PROTECTED] wrote:
   Is there a connection pooling project in Jakarta that I 
 can use for
   database connection pooling? I've found the pool 
 component under Jakarta
   Commons, but is that the only one?
 
  There is DBCP in commons.  I'm not sure if that is what you 
 meant by the
  pool component as there is also a Pool component that is 
 general object
  pooling.  DBCP contains BasicDataSource, which iirc is the default
  connection pool that ships with the latest catalina code.
 
  There is also Jdbc2Pool located in jakarta-commons-sandbox. 
  It uses a
  ConnectionPoolDataSource as its source of connections as opposed a
  Driver as BasicDataSource does.  I would say it is better 
 featured than
  BasicDataSource, but I am the author.  It can be more complex to
  configure.
 
  john mcnally
 
 
 
 
 
  --
  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]

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




RE: front controller pattern and security

2002-06-15 Thread Les Hughes


And of course, static role based security is only half the issue. Most of
the time you want to be checking that the data actioned upon is in the right
state for that action - I'm not just talk about the who can do what but
to whom (data) and when (state). We use a inhouse solution for this
problem at the mo alongside struts. Perhaps this is getting into struts-user
land as opposed to tc-user but maybe Craig and others could comment?

Bye,

Les


 -Original Message-
 From: Martin Jacobson [mailto:[EMAIL PROTECTED]]
 Sent: 14 June 2002 09:00
 To: Tomcat Users List
 Subject: Re: front controller pattern and security
 
 
 John Gregg wrote:
 
  Hi all.
  
  I've been thinking about how the j2ee front controller 
 pattern (used by
  Struts et al.) does/does not take advantage of url-based 
 authorization
  constraints in web.xml.  I want to avoid having to check 
 roles in my own
  code as much as possible.  At first I thought I could 
 declare a URL like
  /somewebapp/somerole/* to require the somerole role 
 before being allowed
  access to my controller servlet.  Another URL would be
  /somewebapp/someotherrole/* but would map to the same 
 servlet.  That servlet
  would then pick off the action at the end of the URL and execute it.
  However, while I can restrict access to the servlet, or 
 whatever other
  physical resource I'm trying to protect, what I really 
 want to protect is
  the action that's executed.  Am I just stuck with 
 enumerating all possible
  actions in by web.xml (/somewebapp/somerole/someaction,
  /somewebapp/somerole/someotheraction, etc.)?  Should I 
 instead make a filter
  that enforces this for me?  I'm facing the same problem 
 with Apache SOAP's
  rpcrouter.
  
 
 
 Surely, the way you describe, using servlet-mapping  auth-constraint 
 does exactly what you want?
 In other words, you have one (controller) servlet declared, 
 and you use 
 servlet-mapping to declare all urls that invoke that servlet. In 
 auth-contstraint you declare the mapping between urls and user roles. 
 So, when a user invokes /app/manager/ac_details, the auth-constraint 
 would trigger an authorisation check to make sure the user was in the 
 indicated role. Then (if he's allowed), because the 
 servlet-mapping maps 
 this url to the controller servlet, the controller servlet is 
 invoked, 
 and, as you say, you can then determine what the action was 
 (ac_details) 
 by examining the url. This method does not restrict access to the 
 controller servlet directly, but does protect the functions 
 to be performed.
 
 Or have I misunderstood?
 
 Martin
 
 
 
 --
 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: Error found while connecting to mysql from JSP page deployed on tomcat

2002-06-15 Thread Les Hughes

I had similar problems. Here's my solution
http://marc.theaimsgroup.com/?l=tomcat-userm=102225547106556w=2

Hope this helps.

 -Original Message-
 From: Jayanta Halder [mailto:[EMAIL PROTECTED]]
 Sent: 14 June 2002 01:24
 To: [EMAIL PROTECTED]
 Subject: Error found while connecting to mysql from JSP page 
 deployed on
 tomcat
 
 
 Hi,
  
 I have installed tomcat on HP-UX box.I have deployed my web 
 application
 on tomcat container.I have copied mysql JDBC driver under common/lib
 area.
  
 While running the application i am getting following error 
  
 Cannot load JDBC driver class 'null'
 java.lang.NullPointerException:
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at
 org.apache.commons.dbcp.BasicDataSource.createDataSource(Unknown
 Source)
 at
 org.apache.commons.dbcp.BasicDataSource.getConnection(Unknown Source)
 at org.apache.jsp.index_0005fmysql$jsp._jspService(Unknown
 Source)
 at org.apache.jasper.runtime.HttpJspBase.service(Unknown
 Source)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at org.apache.jasper.servlet.JspServletWrapper.service(Unknown
 Source)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown
 Source)
 at org.apache.jasper.servlet.JspServlet.service(Unknown
 Source)
 at
 javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
 er(Unknown
 Source)
 at
 org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown
 Source)
 at 
 org.apache.catalina.core.StandardWrapperValve.invoke(Unknown
 Source)
 at
 org.apache.catalina.core.StandardPipeline$StandardPipelineValv
 eContext.invokeNext(Unkno
 wn Source)
 at org.apache.catalina.core.StandardPipeline.invoke(Unknown
 Source)
 at org.apache.catalina.core.ContainerBase.invoke(Unknown
 Source)
 at 
 org.apache.catalina.core.StandardContextValve.invoke(Unknown
 Source)
 at
 org.apache.catalina.core.StandardPipeline$StandardPipelineValv
 eContext.invokeNext(Unkno
 wn Source)
 at org.apache.catalina.core.StandardPipeline.invoke(Unknown
 Source)
 at org.apache.catalina.core.ContainerBase.invoke(Unknown
 Source)
 at org.apache.catalina.core.StandardContext.invoke(Unknown
 Source)
 at org.apache.catalina.core.StandardHostValve.invoke(Unknown
 Source)
 
  
 Can u please tell me what is wrong ?
 
 Thanks,
 
 --
 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: Problem JNDI DataSource - no Connection on MySQL DB

2002-06-12 Thread Les Hughes


I refer the gentlemen to my previous answer :-)

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

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: 12 June 2002 08:30
 To: Tomcat Users List
 Subject: Problem JNDI DataSource - no Connection on MySQL DB
 
 
 Hi,
 
 trying to connect to my MySQL DB via JNDI but I do not get a 
 Connection in detail:
 Using Tomcat 4.03, Linux Suse 7.3, MySQL 3.23.14.
 
 I try to connect with this code:
 .
 .
 .
  Context initCtx = new InitialContext();
 if (initCtx == null) throw new JspException(No Context 
 available for DataSource, can't get connetion);
 Context envCtx = (Context) initCtx.lookup(java:comp/env);
 if (envCtx == null) throw new SQLException(No DataSource 
 availale for Connection (envCtx == null));
   ds = (DataSource)envCtx.lookup(jdbc/wwa-mDB);
 if (ds == null) throw new SQLException(No DataSource 
 availale for Connection (ds == null)  + ds + envCtx =  + envCtx);
verbin = ds.getConnection();
verbin.setReadOnly(true);
 stmt = verbin.createStatement(); 
 .
 .
 an the problem ist that ds == null (envCtx == 
 org.apache.naming.NamingContext@452200).
 I am wondering why I cannot connect the DB. Before I 
 connectet directly like:
 
 Class.forName(org.gjt.mm.mysql.Driver).newInstance(); 
 String url = 
 jdbc:mysql://localhost:3306/wwa-m01?user=userpassword=pwd;
 
 And it worked just fine.
 
 My web.xml-File lookes like:
 resource-ref
  description
 Resource reference to a factory for java.sql.Connection
 instances that may be used for talking to a particular
 database that is configured in the server.xml file.
   /description
   res-ref-namejdbc/wwa-mDB/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref
 
 
 und the server.xml:
 Resource name=jdbc/wwa-mDB auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/wwa-mDB
 
 parameternameuser/namevalueuser/value/parameter
 
 parameternamepassword/namevaluepwd/value/parameter
 
 parameternamedriverClassName/namevalueorg.gjt.mm.mysql
 .Driver/value/parameter
 
 parameternameurl/namevaluejdbc:mysql://localhost:3306/
 wwa_m01/value/parameter
   /ResourceParams
 
 Can you give me any assistance on how to find out what is 
 wrong with my Connection an how I can find out about that?
 
 Thanks a lot!
 
 Rainer
 

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




RE: How to write files when web-app is a WAR?

2002-06-10 Thread Les Hughes


Hi,

I find that too many people make bad assumptions about file system
availability. Nowhere does it say that thou must deploy from an exploded
WAR/filesystem. All too often you see resource loading code using the Evil
getRealPath API call and others instead of getResource or
getResourceAsStream.

Anyway, enough rant. To write temporary files (and there are those that
would say that a web app has no business in writing to the filesystem of the
server it's executing on - security nightmare) you should use

File temp = (File)context.getAttribute(javax.servlet.context.tempdir); 

As per the servlet spec (P30 of my version).

Enjoy,

Les




 -Original Message-
 From: John Burgess [mailto:[EMAIL PROTECTED]]
 Sent: 10 June 2002 11:25
 To: Tomcat Users List
 Subject: RE: How to write files when web-app is a WAR?
 
 
 If the war file is unpacked (which tomcat will do 
 automatically at startup
 unless you specify somewhere in server.xml not to) then it is 
 just as if you
 had deployed to the webapp\your_app directory yourself.  I 
 believe that
 leaving war's unpacked results in slightly worse performance and isn't
 recommended for a deployment server anyway.
 
 Best Wishes
 John Burgess
 [EMAIL PROTECTED]
 Tel: 01865 718666 
 Fax: 01865 718600
 
 
 -Original Message-
 From: Chris Bailey [mailto:[EMAIL PROTECTED]]
 Sent: Friday, June 07, 2002 8:02 PM
 To: Tomcat Mailing List
 Subject: How to write files when web-app is a WAR?
 
 
 From what I've read, it seems that if you package your web 
 application in a
 WAR file, you have no way of attaining a path on the server's 
 file system
 that you can use to write files.  Reference:
 http://mikal.org/interests/java/tomcat/archive/view?mesg=15006.
 
 I have a web app that we'd like to package as a WAR.  But, we 
 need to be
 able to write various data files out to the server's file 
 system.  What
 solution(s) are people using for this?  Writing the files to 
 a database is
 not acceptable for us  (I'm not a DBMS expert, but have been 
 told that BLOB
 performance is not great, and that using a DB as a file 
 system replacement
 is not good, etc.).
 
 I was thinking we'd have to do a bit of a hack...  Basically, 
 at the time we
 install our application, the user will pick the real path 
 on their disk
 where the data files are stored.  We then store this in a property in
 web.xml, and retrieve that in the app for using as the path.  For
 links/hrefs on a web page, we'd just use something like 
 /data_files, but
 then set up a path-mapping that had /data_files mapped to say
 /home/appname/data_files or whatever.   I also am assuming I 
 will need to
 ensure that this real path lies outside of the WAR expanded directory
 because someday Tomcat (and maybe others already?) will not 
 expand the WAR
 file.
 
 Anyway, what have folks come up with?  While we use Tomcat for all our
 development work, we'll likely have to support a variety of Servlet
 containers (I think we can require at least Servlet 2.2, 
 hopefully 2.3).
 
 
 Chris Bailey   mailto:[EMAIL PROTECTED]
 Code Intensity   http://www.codeintensity.com
 
 
 --
 To unsubscribe, e-mail:
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.365 / Virus Database: 202 - Release Date: 24/05/02
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.365 / Virus Database: 202 - Release Date: 24/05/02
  
 
 --
 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: Connection Pooling Solution

2002-05-26 Thread Les Hughes

You probably only downloaded the source, try a nightly build
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-dbcp/

And could you keep your mails to the list instead of direct? That way (a)
someone else might answer first and (b) the answer will end up in the mail
archives.

Thanks

Les


 -Original Message-
 From: Rick Fincher [mailto:[EMAIL PROTECTED]]
 Sent: 24 May 2002 18:37
 To: [EMAIL PROTECTED]
 Subject: Re: Connection Pooling Solution
 
 
 Thanks a million Les,
 
 This is very helpful.
 
 Quick question: I didn't see a jar in th DBCP nightly build after I
 downloaded it, how do you build this thing?
 
 Thanks again,
 
 Rick
 
 - Original Message -
 
  Hi all,
 
  Having felt the pain in getting connection pooling to 
 work with TC 4.0.3
  I've knocked up a simple howto. This is for TC 4.0.3 JDK 
 1.4, mySQL 4.0
  Alpha so YMMV.
 
  Enjoy,
 
  Les
 
  I Downloaded:
 
  Tomcat 4.0.3 LE JDK 1.4 Build
  mySQL4.0.1 alpha
  mm.mysql 2.0.14
 
  Jakarta-Commons projects
  DBCP Nightly Build 20020523
  collections 2.0
  pool1.0
 
  Install mm.mysql, DBCP, collections and pool jars into
  CATALINA_HOME/common/lib
 
  In mySQL, I created a simple DB call javatest with a single table
 (testdata)
  and a new user (javauser) with the password javadude.
 
 
  I created a new Context for my test web app, here's the 
 full server.xml
  entry:
 
  Context path=/DBTest docBase=DBTest
   debug=5 reloadable=true crossContext=true
 
Logger className=org.apache.catalina.logger.FileLogger
prefix=localhost_DBTest_log. suffix=.txt
timestamp=true/
 
Resource name=jdbc/TestDB auth=Container
  type=javax.sql.DataSource/
 
ResourceParams name=jdbc/TestDB
parameter
  namefactory/name
  
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter

 parameternamemaxActive/namevalue100/value/parameter

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

 parameternameusername/namevaluejavauser/value/parameter

 parameternamepassword/namevaluejavadude/value/parameter
 
   parameter
 
 namedriverClassName/namevalueorg.gjt.mm.mysql.Driver/value
   /parameter
 
  parameter

 nameurl/namevaluejdbc:mysql://localhost:3306/javatest/value
  /parameter
/ResourceParams
  /Context
 
  And of course, you'll need this in your web.xml
 
  ?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
descriptionmySQL Test App/description
resource-ref
  descriptionDB Connection/description
  res-ref-namejdbc/TestDB/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
  /web-app
 
  And a snippet of Java to use this:-
 
  try{
  Context ctx = new InitialContext();
  if(ctx == null ) throw new Exception(Boom - No 
 Context);
 
  DataSource ds =
  (DataSource)ctx.lookup(java:comp/env/jdbc/TestDB);
  if (ds != null) {
 
  Connection conn = ds.getConnection();
 
  if(conn != null)  {
  foo = Got Connection +conn.toString();
  Statement stmt = conn.createStatement();
  ResultSet rst = 
 stmt.executeQuery(select id, foo, bar
  from testdata);
  if(rst.next()) {
  foo=rst.getString(2);
  bar=rst.getInt(3);
  }
  conn.close();
  }
  }
  }catch(Exception e) {
  e.printStackTrace();
  }
 
 
  That's all folks.Hope this is of use to you.
 
 
 
  --
  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]




Connection Pooling Solution

2002-05-24 Thread Les Hughes

Hi all,

Having felt the pain in getting connection pooling to work with TC 4.0.3
I've knocked up a simple howto. This is for TC 4.0.3 JDK 1.4, mySQL 4.0
Alpha so YMMV.

Enjoy,

Les

I Downloaded:

Tomcat   4.0.3 LE JDK 1.4 Build
mySQL4.0.1 alpha
mm.mysql 2.0.14

Jakarta-Commons projects
DBCP Nightly Build 20020523
collections 2.0
pool1.0

Install mm.mysql, DBCP, collections and pool jars into
CATALINA_HOME/common/lib

In mySQL, I created a simple DB call javatest with a single table (testdata)
and a new user (javauser) with the password javadude.


I created a new Context for my test web app, here's the full server.xml
entry:

Context path=/DBTest docBase=DBTest
 debug=5 reloadable=true crossContext=true

  Logger className=org.apache.catalina.logger.FileLogger
  prefix=localhost_DBTest_log. suffix=.txt
  timestamp=true/

  Resource name=jdbc/TestDB auth=Container
type=javax.sql.DataSource/

  ResourceParams name=jdbc/TestDB
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameternamemaxActive/namevalue100/value/parameter
  parameternamemaxIdle/namevalue3/value/parameter
  parameternamemaxWait/namevalue100/value/parameter


  parameternameusername/namevaluejavauser/value/parameter
  parameternamepassword/namevaluejavadude/value/parameter
  
 parameter
   namedriverClassName/namevalueorg.gjt.mm.mysql.Driver/value
 /parameter

parameter
  nameurl/namevaluejdbc:mysql://localhost:3306/javatest/value
/parameter
  /ResourceParams
/Context

And of course, you'll need this in your web.xml

?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  
  descriptionmySQL Test App/description
  resource-ref
descriptionDB Connection/description
res-ref-namejdbc/TestDB/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
/web-app

And a snippet of Java to use this:-

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

DataSource ds =
(DataSource)ctx.lookup(java:comp/env/jdbc/TestDB);
if (ds != null) {

Connection conn = ds.getConnection();
  
if(conn != null)  {
foo = Got Connection +conn.toString();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery(select id, foo, bar
from testdata);
if(rst.next()) {
foo=rst.getString(2);
bar=rst.getInt(3);
}
conn.close();
}
}
}catch(Exception e) {
e.printStackTrace();
}


That's all folks.Hope this is of use to you.



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