Re: Multipart Request

2005-10-09 Thread Dhiren Bhatia
Yea, I'm using Struts. I like some of its features so I want to continue
using it. But multipart is a mess. So, is there any way to retain the
parameters in HTTPServletRequest?
 Thanks.

 On 10/9/05, Dakota Jack [EMAIL PROTECTED] wrote:

 Are you using Struts? Struts has a bizarre idea that causes this type
 of problem.



 On 10/8/05, Dhiren Bhatia [EMAIL PROTECTED] wrote:
  Hi all,
  I'm having trouble with the HttpServletRequest object if my post
 contains
  multipart data. The request object loses all the parameters set from the
  html form.
  i.e. request.getParameter(myParam); always returns null. If I remove
 the
  multipart encoding from my form, I see the parameter values.
  If I use the OReilly MultipartRequest, the constructor needs me to set
 the
  directory to save the file in so I cannot make that value dynamic by
  receiving it from the HTTP post. I want to receive the dir name where
 the
  file will be saved from the HTML form.
  Any ideas? Hope this makes sense.
  Thanks,
  -D
 
 


 --
 You can lead a horse to water but you cannot make it float on its back.
 ~Dakota Jack~

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




Multipart Request

2005-10-08 Thread Dhiren Bhatia
Hi all,
 I'm having trouble with the HttpServletRequest object if my post contains
multipart data. The request object loses all the parameters set from the
html form.
i.e. request.getParameter(myParam); always returns null. If I remove the
multipart encoding from my form, I see the parameter values.
 If I use the OReilly MultipartRequest, the constructor needs me to set the
directory to save the file in so I cannot make that value dynamic by
receiving it from the HTTP post. I want to receive the dir name where the
file will be saved from the HTML form.
 Any ideas? Hope this makes sense.
 Thanks,
-D


Tomcat DB Connection Pooling

2005-09-06 Thread Dhiren Bhatia
Hi
 I'm having a problem reclaiming connections in my database connection pool. 
I'm using the standard db conn pooling with Tomcat 5.5.9 with MySQL.
 I release the connection as well as close the PreparedStatement in the code 
after use. However, I still get errors with logEnabled set to true saying 
that the connection was not released. I tried the same code using a simple 
Statement object instead of a PreparedStatement and DID NOT see the errors. 
The SQL I'm running in an update, i.e. Insert statement.
 Are there any issues reclaiming connections from a PreparedStatement?
 Thanks,
 Dhiren


Re: DBCP ClassCastException

2005-05-09 Thread Dhiren Bhatia
Hi Lutz,
 I changed the Resource tag definition to:
  Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource

maxActive=100 maxIdle=30 maxWait=1
driverClassName=com.mysql.jdbc.Driver/
 I'm setting the username/password and jdbcurl using code.
 I still get the same ClassCastException. Is Tomcat instantiating the 
correct DataSourceFactory?
I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib
 Thanks,
 Dhiren

 On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: 
 
 Hi Dhiren,
 
 Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia:
  Hi all,
 
  I'm getting a the following ClassCastException running Tomcat 5.5.9
  with MySQL
 
  java.lang.ClassCastException:
  org.apache.tomcat.dbcp.dbcp.BasicDataSource
 
  Here's the relevant code:
  *Java code:*
  org.apache.commons.dbcp.BasicDataSource datasource;
 
  datasource =
  (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver);
 
  *web.xml*
  resource-ref
  descriptionDB Connection/description
  res-ref-namejdbc/myserver/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
  /resource-ref
  *server.xml*
  **
  ResourceParams name=jdbc/myserver
  parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  *...*
 
 
  This same code works in Tomcat 5.0.30.
 
  Has anything changed? Am I missing something?
 
 Yes. The syntax for the Resource tag in the server.xml has changed. The
 resource parameters are no longer defined in tags nested into the
 Resource tag, but in attributes of the tag. This is an example from the
 Tomcat 5.5 documentation:
 
 Resource name=jdbc/TestDB auth=Container
 type=javax.sql.DataSource maxActive=100 maxIdle=30
 maxWait=1 username=javauser password=javadude
 driverClassName=com.mysql.jdbc.Driver
 url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/
 
 
 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
 
 Best wishes,
 
 Lutz
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: DBCP ClassCastException

2005-05-09 Thread Dhiren Bhatia
I'm using BasicDataSource because javax.sql.DataSource does not have methods 
to set the driver class name, url, username/pwd etc. My app needs to support 
different databases and the driver is loaded based on which database is 
installed.
 If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not 
portable to JBoss/Weblogic etc right? BTW, which jar is 
org.apache.tomcat.dbcp.dbcp.BasicDataSource in?
 Thanks for your response.
 Dhiren


 On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: 
 
 Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the 
 source and put it in other packages.
 So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of 
 org.apache.commons.dbcp.BasicDataSource in your source - btw why do you 
 cast to BasicDataSource, you can use javax.sql.DataSource?
 
 Gernot
 
 -Ursprüngliche Nachricht-
 Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED]
 Gesendet: Montag, 09. Mai 2005 17:19
 An: Tomcat Users List
 Betreff: Re: DBCP ClassCastException
 
 
 Hi Lutz,
 I changed the Resource tag definition to:
 Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource
 
 maxActive=100 maxIdle=30 maxWait=1
 driverClassName=com.mysql.jdbc.Driver/
 I'm setting the username/password and jdbcurl using code.
 I still get the same ClassCastException. Is Tomcat instantiating the
 correct DataSourceFactory?
 I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib
 Thanks,
 Dhiren
 
 On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote:
 
  Hi Dhiren,
 
  Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia:
   Hi all,
  
   I'm getting a the following ClassCastException running Tomcat 5.5.9
   with MySQL
  
   java.lang.ClassCastException:
   org.apache.tomcat.dbcp.dbcp.BasicDataSource
  
   Here's the relevant code:
   *Java code:*
   org.apache.commons.dbcp.BasicDataSource datasource;
  
   datasource =
   (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver);
  
   *web.xml*
   resource-ref
   descriptionDB Connection/description
   res-ref-namejdbc/myserver/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
   /resource-ref
   *server.xml*
   **
   ResourceParams name=jdbc/myserver
   parameter
   namefactory/name
   valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   *...*
  
  
   This same code works in Tomcat 5.0.30.
  
   Has anything changed? Am I missing something?
 
  Yes. The syntax for the Resource tag in the server.xml has changed. The
  resource parameters are no longer defined in tags nested into the
  Resource tag, but in attributes of the tag. This is an example from the
  Tomcat 5.5 documentation:
 
  Resource name=jdbc/TestDB auth=Container
  type=javax.sql.DataSource maxActive=100 maxIdle=30
  maxWait=1 username=javauser password=javadude
  driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/
 
 
  
 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
 
  Best wishes,
 
  Lutz
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: DBCP ClassCastException

2005-05-09 Thread Dhiren Bhatia
It works if I use org.apache.tomcat.dbcp.dbcp.BasicDataSource.
 I've tried adding all the commons jars to common/lib and it still doesn't 
work with org.apache.commons.dbcp.BasicDataSource. How do you get it to cast 
with your own resource factory? The way I see it, it should be the same 
thing if you're extending from org.apache.commons.dbcp.BasicDataSource.
 Just FYI...Here's what I have in commons/lib:
 commons-collections-3.1.jar* log4j.jar*
commons-dbcp-1.2.1.jar* mysql-connector-java-3.1.7-bin.jar*
commons-pool-1.2.jar* naming-factory-dbcp.jar*
jasper-compiler-jdt.jar* naming-factory.jar*
jasper-compiler.jar* naming-resources.jar*
jasper-runtime.jar* servlet-api.jar*
jsp-api.jar*

 On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: 
 
 You can find org.apache.tomcat.dbcp.dbcp.BasicDataSource in 
 common/lib/naming-factory-dbcp.jar.
 If you put commons-dbcp.jar, commons-pool.jar and commons-collections.jarin 
 common/lib you (maybe) should be able to use 
 org.apache.commons.dbcp.BasicDataSource.
 I do it in a similar way - I have my own ressource factory, which extends 
 org.apache.commons.dbcp.BasicDataSourceFactory and it works in tomcat 5.5with 
 the above jars.
 
 Gernot
 
 -Ursprüngliche Nachricht-
 Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED]
 Gesendet: Montag, 09. Mai 2005 18:47
 An: Tomcat Users List
 Betreff: Re: DBCP ClassCastException
 
 I'm using BasicDataSource because javax.sql.DataSource does not have 
 methods
 to set the driver class name, url, username/pwd etc. My app needs to 
 support
 different databases and the driver is loaded based on which database is
 installed.
 If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not
 portable to JBoss/Weblogic etc right? BTW, which jar is
 org.apache.tomcat.dbcp.dbcp.BasicDataSource in?
 Thanks for your response.
 Dhiren
 
 On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote:
 
  Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the
  source and put it in other packages.
  So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of
  org.apache.commons.dbcp.BasicDataSource in your source - btw why do you
  cast to BasicDataSource, you can use javax.sql.DataSource?
 
  Gernot
 
  -Ursprüngliche Nachricht-
  Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED]
  Gesendet: Montag, 09. Mai 2005 17:19
  An: Tomcat Users List
  Betreff: Re: DBCP ClassCastException
 
 
  Hi Lutz,
  I changed the Resource tag definition to:
  Resource name=jdbc/myserver auth=Container type=
 javax.sql.DataSource
  
  maxActive=100 maxIdle=30 maxWait=1
  driverClassName=com.mysql.jdbc.Driver/
  I'm setting the username/password and jdbcurl using code.
  I still get the same ClassCastException. Is Tomcat instantiating the
  correct DataSourceFactory?
  I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib
  Thanks,
  Dhiren
 
  On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote:
  
   Hi Dhiren,
  
   Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia:
Hi all,
   
I'm getting a the following ClassCastException running Tomcat 5.5.9
with MySQL
   
java.lang.ClassCastException:
org.apache.tomcat.dbcp.dbcp.BasicDataSource
   
Here's the relevant code:
*Java code:*
org.apache.commons.dbcp.BasicDataSource datasource;
   
datasource =
(BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver);
   
*web.xml*
resource-ref
descriptionDB Connection/description
res-ref-namejdbc/myserver/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
*server.xml*
**
ResourceParams name=jdbc/myserver
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
*...*
   
   
This same code works in Tomcat 5.0.30.
   
Has anything changed? Am I missing something?
  
   Yes. The syntax for the Resource tag in the server.xml has changed. 
 The
   resource parameters are no longer defined in tags nested into the
   Resource tag, but in attributes of the tag. This is an example from 
 the
   Tomcat 5.5 documentation:
  
   Resource name=jdbc/TestDB auth=Container
   type=javax.sql.DataSource maxActive=100 maxIdle=30
   maxWait=1 username=javauser password=javadude
   driverClassName=com.mysql.jdbc.Driver
   url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/
  
  
  
  
 http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html
  
   Best wishes,
  
   Lutz
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail

DBCP ClassCastException

2005-05-08 Thread Dhiren Bhatia
Hi all,

I'm getting a the following ClassCastException running Tomcat 5.5.9 with 
MySQL

java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource

Here's the relevant code:
 *Java code:*
org.apache.commons.dbcp.BasicDataSource datasource;

datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver);

*web.xml*
resource-ref
descriptionDB Connection/description
res-ref-namejdbc/myserver/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref
 *server.xml*
**
 ResourceParams name=jdbc/myserver
parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
*...*


This same code works in Tomcat 5.0.30.

Has anything changed? Am I missing something?

Thanks.