tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Januski, Ken" <>
Subject RE: Another Try at MySQL Connection Pooling
Date Wed, 11 Feb 2004 18:36:54 GMT
Much of what you're doing is just beyond me but I can't help but noticing
this in your first post.

Since you've included a password value in all the other places I'm wondering
if the lack of it here could be part of the problem.

Sorry if I'm way off base,


-----Original Message-----
From: Merrill Cornish []
Sent: Tuesday, February 10, 2004 5:25 PM
Subject: Another Try at MySQL Connection Pooling

I'm running 
  * Tomcat 5.0.18 running as a Wndows service, 
  * MySQL 4.0.16 running as a Windows service, and 
  * MySQL Connector/J 3.0.10 stable 
all on Windows 2000 Server, which is where I'm also doing the testing (i.e.,
on localhost).

A number of tomcat-user mailing list denizens have given me snippets of XML
to put in various places. Nothing worked.  So I tried following the "MySQL
Configuration" example from
to.html. After all changes were made to server.xml, web.xml and
timesheet.xml (the <context> fragment under conf/Catalina/localhost), I
restarted Tomcat and tried to login (the first action that would have had to
touch the MySQL database).

I got the following errorPage:

> At Timesheet.Util.errorPage( there occurred a
> java.lang.Exception: A fatal exception occurred while retrieving login
name and pass phrase because...
> At Timesheet.Util.getSqlConnection( there occurred a
> java.lang.Exception: Unable to establish a MysqlDataSource connection for
ResourceLine name "jdbc/TimesheetsDB" >because...
> At org.apache.naming.NamingContext.lookup( there
occurred a
> javax.naming.NameNotFoundException: Name jdbc is not bound in this Context

OK, that seems to say it doesn't know what the name "jdbc/TimesheetsDB" is.
Tomcat has written nothing to stderr.log and stdout.log shows a clean
startup, so Tomcat itself isn't too perturbed.  stdout.log includes the
following line:

> INFO: Processing Context configuration file URL file:C:\Program
Files\Apache Group\Tomcat 5.0.18\conf\Catalina\localhost\timesheet.xml

implying that my timesheet.xml context fragment file was found and
processed.  The Timesheet application log file contains the following:

> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Resource parameters for jdbc/TimesheetsDB =
ysql.jdbc.NamedPipeSocketFactory, password=All41a14all, maxWait=10000,
username=timesheet_app, maxIdle=30}]

> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Adding resource ref jdbc/TimesheetsDB

> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:

> 2004-02-10 16:20:05 NamingContextListener[/Catalina/localhost/timesheet]:
Resource parameters for UserTransaction = null

[Blank lines added for clarity.]  As per the instructions in the
jndi-datasource-examples-howto.html page, my web.xml file has the following

>  <resource-ref>
>     <description>MySql Connection Pool</description>
>     <res-ref-name>jdbc/TimesheetsDB</res-ref-name>
>     <res-type>javax.sql.DataSource</res-type>
>     <res-auth>Container</res-auth>
>  </resource-ref>

immediately after the <error-page> element and immediately before the
<security-constraint> element.

Now that I am using the timesheet.xml <context> fragment file, server.xml is
unchanged except that I have modified it to use port 80 in place of 8080 and
port 443 in place of 8443.

The timesheet.xml <context> fragment file looks like this:

<Context path="/timesheet" docBase="timesheet" debug="9" reloadable="true"
         crossContext="true" displayName="ConnectTel Timesheet Application">
  <Logger className="org.apache.catalina.logger.FileLogger"
          prefix="localhost_timesheet_log." suffix=".txt" timestamp="true"/>
  <Resource name="jdbc/TimesheetsDB" auth="Container"
  <ResourceParams name="jdbc/TimesheetsDB">
      <name>maxActive</name> <!-- max db connections in the pool -->
      <value>100</value>     <!-- 0 implies no limit -->
      <name>maxIdle</name>   <!-- max idle db connections to retain in pool
      <value>30</value>      <!-- 0 implies no limit -->
      <name>maxWait</name>   <!-- max wait for connection before throwing
exception -->
      <value>10000</value>   <!-- -1 implies no limit (time is in
milliseconds) -->

       <name>driverClassName</name> <!-- Class name for mm.mysql JDBC driver

I apologize for being so verbose, but I'm trying to provide all of the
relevant information in the initial message.  Does anyone see what I've
missed?  The example in jndi-datasource-examples-howto.html does NOT look
like the other things I was told to do.  (?)


To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message