Re: mysql connection pooling problem

2003-08-27 Thread Eugene Lee
On Tue, Aug 26, 2003 at 08:25:31AM -0600, Steve Wilkinson wrote:
: 
: I followed the example at 
: 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example.
: 
: The only thing I see wrong is the following line of code:
: 
: DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev)
: 
: should be java:comp/env/jdbc/testdev as already mentioned earlier.

Thanks Steve.  An earlier response mentioned the same typo, and I've
already fixed it.  But I still get the same error message.

: Thus, I've attached my example for you to compare.  Note, DBCP 
: connection pool requires additional jars as indicated in the README.txt 
: file.  I assume you already know this, but I mention it just incase.

Yep, I've got all those JARs in $CATALINA_HOME/common/lib.


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-26 Thread Christopher Garrett
This is an absolute shot in the dark, but I believe you might have to put a JAR
with JDBC drivers into WEB-INF/lib.

Christopher Garrett III
Inixoma, Incorporated

- Original Message -
From: Eugene Lee [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, August 25, 2003 8:13 AM
Subject: Re: mysql connection pooling problem


Hi James,

I tried inserting the context-param into web-app, no effect.

But thanks for catching the typo in my JSP code in the lookup() line.
Unfortunately, this had no effect either.  I still get the infamous
Cannot load JDBC driver class 'null' error... hurmmm...

Any suggestions from others are appreciated too!  Anyone?


On Sat, Aug 23, 2003 at 11:09:36AM -0600, James Harman wrote:
: Eugene Lee wrote:
: On Sat, Aug 23, 2003 at 08:59:05AM -0600, James Harman wrote:
: :
: : I noticed that in the web.xml you have the jbdc resource in a
: : resource-ref.  In my stuff I have it as a context-param like this
: :
: : context-param
: :param-name
: :  javax.servlet.jsp.jstl.sql.dataSource
: :/param-name
: :param-value
: :jdbc/testdev
: :/param-value
: :  /context-param
: :
: : This comes right after the web-app element in the web.xml file.
: :
: : I am not experienced enough to know the difference between context-param
: : and resource-ref, but this seems to work for me.
:
: Another thing you might look at is your jsp code.  You have
:
: DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev);
:
: you probably want
:
: DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/testdev);
:
: notice that there is no / before comp.


--
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

-
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: mysql connection pooling problem

2003-08-26 Thread Purvis Robert
Or put it into tomcat4/common/lib - because then all web applications can
access the JDBC driver.

Rob

-Original Message-
From: Christopher Garrett [mailto:[EMAIL PROTECTED] 
Sent: 26 August 2003 10:43
To: Tomcat Users List
Subject: Re: mysql connection pooling problem


This is an absolute shot in the dark, but I believe you might have to put a
JAR with JDBC drivers into WEB-INF/lib.

Christopher Garrett III
Inixoma, Incorporated

- Original Message -
From: Eugene Lee [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, August 25, 2003 8:13 AM
Subject: Re: mysql connection pooling problem


Hi James,

I tried inserting the context-param into web-app, no effect.

But thanks for catching the typo in my JSP code in the lookup() line.
Unfortunately, this had no effect either.  I still get the infamous Cannot
load JDBC driver class 'null' error... hurmmm...

Any suggestions from others are appreciated too!  Anyone?


On Sat, Aug 23, 2003 at 11:09:36AM -0600, James Harman wrote:
: Eugene Lee wrote:
: On Sat, Aug 23, 2003 at 08:59:05AM -0600, James Harman wrote:
: :
: : I noticed that in the web.xml you have the jbdc resource in a
: : resource-ref.  In my stuff I have it as a context-param like this
: :
: : context-param
: :param-name
: :  javax.servlet.jsp.jstl.sql.dataSource
: :/param-name
: :param-value
: :jdbc/testdev
: :/param-value
: :  /context-param
: :
: : This comes right after the web-app element in the web.xml file.
: :
: : I am not experienced enough to know the difference between
context-param
: : and resource-ref, but this seems to work for me.
:
: Another thing you might look at is your jsp code.  You have
:
: DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev);
:
: you probably want
:
: DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/testdev);
:
: notice that there is no / before comp.


--
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

-
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]
This e-mail is confidential and privileged.  If you are not the intended
recipient please accept our apologies;  please do not disclose, copy or
distribute information in this e-mail or take any action in reliance on its
contents:  to do so is strictly prohibited and may be unlawful.  Please
inform us that this message has gone astray before deleting it.  Thank you
for your co-operation.

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



Re: mysql connection pooling problem

2003-08-26 Thread Eugene Lee
On Tue, Aug 26, 2003 at 05:43:02AM -0400, Christopher Garrett wrote:
: 
: This is an absolute shot in the dark, but I believe you might have to
: put a JAR with JDBC drivers into WEB-INF/lib.

Hi Christopher,

Thanks for the suggestion.  But as I mentioned in my original message,
I already tried this to no avail... :-/


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-26 Thread Eugene Lee
On Tue, Aug 26, 2003 at 11:24:21AM +0100, Purvis, Robert wrote:
: 
: Or put it into tomcat4/common/lib - because then all web applications can
: access the JDBC driver.

Hi Rob,

Thanks for the suggestion.  But as I mentioned in my original message,
I already tried this to no avail.  I went through all the usual spots
($CATALINA_HOME/common/lib, $JAVA_HOME/jre/lib/ext, and even my webapp's
WEB-INF/lib) and got nada.


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-26 Thread Paul
Did you try this directory (to place jdbc jar files)?

%CATALINA_HOME%\shared\lib\ojdbc14.jar

I have a connection pool setup for Oracle, and the .jsp pages (and/or
tomcat) can find the classes used if the jdbc drivers are placed in the
above directory.
-pl

- Original Message - 
From: Eugene Lee [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Tuesday, August 26, 2003 8:40 AM
Subject: Re: mysql connection pooling problem


 On Tue, Aug 26, 2003 at 11:24:21AM +0100, Purvis, Robert wrote:
 :
 : Or put it into tomcat4/common/lib - because then all web applications
can
 : access the JDBC driver.

 Hi Rob,

 Thanks for the suggestion.  But as I mentioned in my original message,
 I already tried this to no avail.  I went through all the usual spots
 ($CATALINA_HOME/common/lib, $JAVA_HOME/jre/lib/ext, and even my webapp's
 WEB-INF/lib) and got nada.


 -- 
 Eugene Lee
 http://www.coxar.pwp.blueyonder.co.uk/

 -
 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: mysql connection pooling problem

2003-08-26 Thread Eugene Lee
On Tue, Aug 26, 2003 at 09:28:14AM -0400, Paul wrote:
: Eugene Lee responded:
:  On Tue, Aug 26, 2003 at 11:24:21AM +0100, Purvis, Robert wrote:
:  :
:  : Or put it into tomcat4/common/lib - because then all web
:  : applications can access the JDBC driver.
: 
:  Thanks for the suggestion.  But as I mentioned in my original message,
:  I already tried this to no avail.  I went through all the usual spots
:  ($CATALINA_HOME/common/lib, $JAVA_HOME/jre/lib/ext, and even my webapp's
:  WEB-INF/lib) and got nada.
: 
: Did you try this directory (to place jdbc jar files)?
: 
: %CATALINA_HOME%\shared\lib\ojdbc14.jar

Hi Paul,

As I mentioned in my original message, I have already tried installing
the driver, MySQL Connector/J 3.0.8, in all of the directories mentioned
above (note that %CATALINA_HOME%\shared\lib\ is the same thing as
$CATALINA_HOME/common/lib on a Unix platform).


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-26 Thread Steve Wilkinson
Eugene,

I followed the example at 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example.

The only thing I see wrong is the following line of code:

DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev)

should be java:comp/env/jdbc/testdev as already mentioned earlier.

Thus, I've attached my example for you to compare.  Note, DBCP 
connection pool requires additional jars as indicated in the README.txt 
file.  I assume you already know this, but I mention it just incase.

Hope this helps,

Steve

Eugene Lee wrote:

I'm having a really odd problem connecting to a local MySQL server.  If
I use java.sql.DriverManager.getConnection(), it works perfectly fine.
But when I try to use a connection pool:
	http://www.mysql.com/articles/connection_pooling_with_connectorj.html

it errors out:

	java.sql.SQLException: Cannot load JDBC driver class 'null'

I've tried moving the MySQL driver to $CATALINA_HOME/common/lib,
$JAVA_HOME/jre/lib/ext, and even my webapp's WEB-INF/lib.  The results
are still the same.
I've followed the often-recommended Tomcat 4.1 documentation to no avail.
Here's what my box is running:
	FreeBSD 4.8-RELEASE-p3   
	Java 2 SDK 1.3.1_09
	Jakarta-Tomcat 4.1.27
	MySQL Connector/J 3.0.8

I've attached my server.xml, my webapp's web.xml, and a test page
test.jsp to demonstrate the error.  BTW, before it throws the exception
on the getconnection(), the page output is:
con1 works!
DS lookup OK!
I appreciate any suggestions.  Much thanks in advance.





Server port=8005 shutdown=SHUTDOWN debug=0

  Listener className=org.apache.catalina.mbeans.ServerLifecycleListener
debug=0/
  Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener
debug=0/
  !-- Global JNDI resources --
  GlobalNamingResources
!-- Editable user database that can also be used by
 UserDatabaseRealm to authenticate users --
Resource name=UserDatabase auth=Container
  type=org.apache.catalina.UserDatabase
  description=User database that can be updated and saved
/Resource
ResourceParams name=UserDatabase
  parameter
namefactory/name
valueorg.apache.catalina.users.MemoryUserDatabaseFactory/value
  /parameter
  parameter
namepathname/name
valueconf/tomcat-users.xml/value
  /parameter
/ResourceParams
  /GlobalNamingResources

  Service name=Tomcat-Apache

Connector className=org.apache.catalina.connector.warp.WarpConnector
   port=8008 minProcessors=5 maxProcessors=75
   enableLookups=true appBase=webapps acceptCount=10
   debug=0/
Engine className=org.apache.catalina.connector.warp.WarpEngine
name=Apache debug=0
Logger className=org.apache.catalina.logger.FileLogger
prefix=catalina_log. suffix=.txt timestamp=true/
Host name=localhost debug=0 appBase=webapps
  unpackWARs=true autoDeploy=true
  Logger className=org.apache.catalina.logger.FileLogger
  directory=logs  prefix=localhost_log. suffix=.txt
  timestamp=true/
  Context path=/testdev docBase=testdev debug=0 reloadable=true
   crossContext=true
Logger className=org.apache.catalina.logger.FileLogger
prefix=testdev_log. suffix=.txt
timestamp=true/
Resource name=jdbc/testdev auth=Container
  type=javax.sql.DataSource/
ResourceParams name=jdbc/testdev
  parameter
namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
namemaxActive/name
value500/value
  /parameter
  parameter
namemaxIdle/name
value500/value
  /parameter
  parameter
namemaxWait/name
value1/value
  /parameter
  parameter
nameusername/name
value/value
  /parameter
  parameter
namepassword/name
value/value
  /parameter
  parameter
namedriverClassName/name
valuecom.mysql.jdbc.Driver/value
  /parameter
  parameter
nameurl/name
valuejdbc:mysql://localhost/testdev/value
  /parameter
/ResourceParams
  /Context
/Host

Realm className=org.apache.catalina.realm.MemoryRealm /

/Engine

  /Service

/Server



?xml version=1.0 encoding=UTF-8?
!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 id=TESTDEV
display-nametestdev/display-name
servlet

Re: mysql connection pooling problem

2003-08-25 Thread Eugene Lee
Hi James,

I tried inserting the context-param into web-app, no effect.

But thanks for catching the typo in my JSP code in the lookup() line.
Unfortunately, this had no effect either.  I still get the infamous
Cannot load JDBC driver class 'null' error... hurmmm...

Any suggestions from others are appreciated too!  Anyone?


On Sat, Aug 23, 2003 at 11:09:36AM -0600, James Harman wrote:
: Eugene Lee wrote:
: On Sat, Aug 23, 2003 at 08:59:05AM -0600, James Harman wrote:
: : 
: : I noticed that in the web.xml you have the jbdc resource in a 
: : resource-ref.  In my stuff I have it as a context-param like this
: : 
: : context-param
: :param-name
: :  javax.servlet.jsp.jstl.sql.dataSource
: :/param-name
: :param-value
: :jdbc/testdev
: :/param-value
: :  /context-param
: : 
: : This comes right after the web-app element in the web.xml file. 
: : 
: : I am not experienced enough to know the difference between context-param 
: : and resource-ref, but this seems to work for me.
:
: Another thing you might look at is your jsp code.  You have
: 
: DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev);
: 
: you probably want
: 
: DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/testdev);
: 
: notice that there is no / before comp.


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-23 Thread James Harman
Eugene,

I noticed that in the web.xml you have the jbdc resource in a 
resource-ref.  In my stuff I have it as a context-param like this

context-param
   param-name
 javax.servlet.jsp.jstl.sql.dataSource
   /param-name
   param-value
   jdbc/testdev
   /param-value
 /context-param
This comes right after the web-app element in the web.xml file. 

I am not experienced enough to know the difference between context-param 
and resource-ref, but this seems to work for me.

James

Eugene Lee wrote:

I'm having a really odd problem connecting to a local MySQL server.  If
I use java.sql.DriverManager.getConnection(), it works perfectly fine.
But when I try to use a connection pool:
	http://www.mysql.com/articles/connection_pooling_with_connectorj.html

it errors out:

	java.sql.SQLException: Cannot load JDBC driver class 'null'

I've tried moving the MySQL driver to $CATALINA_HOME/common/lib,
$JAVA_HOME/jre/lib/ext, and even my webapp's WEB-INF/lib.  The results
are still the same.
I've followed the often-recommended Tomcat 4.1 documentation to no avail.
Here's what my box is running:
	FreeBSD 4.8-RELEASE-p3   
	Java 2 SDK 1.3.1_09
	Jakarta-Tomcat 4.1.27
	MySQL Connector/J 3.0.8

I've attached my server.xml, my webapp's web.xml, and a test page
test.jsp to demonstrate the error.  BTW, before it throws the exception
on the getconnection(), the page output is:
con1 works!
DS lookup OK!
I appreciate any suggestions.  Much thanks in advance.

 



-
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: mysql connection pooling problem

2003-08-23 Thread Eugene Lee
On Sat, Aug 23, 2003 at 08:59:05AM -0600, James Harman wrote:
: 
: Eugene,
: 
: I noticed that in the web.xml you have the jbdc resource in a 
: resource-ref.  In my stuff I have it as a context-param like this
: 
: context-param
:param-name
:  javax.servlet.jsp.jstl.sql.dataSource
:/param-name
:param-value
:jdbc/testdev
:/param-value
:  /context-param
: 
: This comes right after the web-app element in the web.xml file. 
: 
: I am not experienced enough to know the difference between context-param 
: and resource-ref, but this seems to work for me.

I'm using resource-ref because that's what the Tomcat docs say.  :-)


http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example

I'll try it out later today and report back with the results.


-- 
Eugene Lee
http://www.coxar.pwp.blueyonder.co.uk/

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



Re: mysql connection pooling problem

2003-08-23 Thread James Harman
Another thing you might look at is your jsp code.  You have

DataSource ds = (DataSource)ctx.lookup(java:/comp/env/jdbc/testdev);

you probably want

DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/testdev);

notice that there is no / before comp.

James

Eugene Lee wrote:

On Sat, Aug 23, 2003 at 08:59:05AM -0600, James Harman wrote:
: 
: Eugene,
: 
: I noticed that in the web.xml you have the jbdc resource in a 
: resource-ref.  In my stuff I have it as a context-param like this
: 
: context-param
:param-name
:  javax.servlet.jsp.jstl.sql.dataSource
:/param-name
:param-value
:jdbc/testdev
:/param-value
:  /context-param
: 
: This comes right after the web-app element in the web.xml file. 
: 
: I am not experienced enough to know the difference between context-param 
: and resource-ref, but this seems to work for me.

I'm using resource-ref because that's what the Tomcat docs say.  :-)

	http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example

I'll try it out later today and report back with the results.

 



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