tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thavutam, Prashanth" <1thav...@toysrus.com>
Subject DataSource configuration for Tomcat 5.0.28
Date Mon, 15 Nov 2004 17:48:04 GMT
After a bit of struggle, I had figured out the DataSource configuration for
Tomcat 5.0.28. Thought this might help others.

Configuring Mysql Data Source on Tomcat for Registration Application.

1.	Extract the war file contents into \Tomcat 5.0\webapps folder.
2.	Create registration.xml file in \Tomcat 5.0\conf\Catalina\localhost
folder and add below entries in the xml file.
<Context path="/registration"
  docBase="${catalina.home}/webapps/registration"  debug="0">
  <ResourceLink name="jdbc/RegistrationDB" />
</Context>

3.	Add below entries in web.xml.
   a)     <resource-ref>
	      <description>DB Connection</description>
	      <res-ref-name>jdbc/RegistrationDB</res-ref-name>
	      <res-type>javax.sql.DataSource</res-type>
	      <res-auth>Container</res-auth>
        </resource-ref>
	
   b) 	If it is struts based application, in my case it is, change path
from WEB-INF/struts-config.xml to /WEB-INF/struts-config.xml and
WEB-INF/forwardDefinition.xml to /WEB-INF/forwardDefinition.xml in web.xml
file. Entry must start with "/".

4.	Add below entries in server.xml for MySql database. Make sure this
entry is copied as a child to HOST element.

    <DefaultContext>
          <Resource name="jdbc/RegistrationDB" scope="Shareable"
                    type="javax.sql.DataSource">
          </Resource>
          <ResourceParams name="jdbc/RegistrationDB">
            <parameter><name>username</name>
            <value>!username!</value></parameter>
            <parameter><name>password</name>
            <value>!password!</value></parameter>
            <parameter><name>driverClassName</name>
 
<value>com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource</value>
            </parameter>
            <parameter><name>url</name>
 
<value>jdbc:mysql://<server>:<port>/<db-name>?autoReload=true</value>
            </parameter>
	    <parameter>
             	<name>maxActive</name>
             	<value>8</value>
             </parameter>
             <parameter>
             	<name>maxIdle</name>
             	<value>4</value>
             </parameter>
           </ResourceParams>
      </DefaultContext>

5.	Copy the mysql-connector-java-3.1.4-beta-bin.jar file in common/lib
folder.
6.	Comment out
<teiclass>org.apache.struts.taglib.html.ErrorsTei</teiclass> from
struts-validator.tld file in WEB-INF folder. Or, we might need to keep the
related jar file in the classpath.

Regards,
Prashanth


======================================================================== 
This email message is for the sole use of the intended recipient (s) and may
contain confidential and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message. To reply to our email administrator directly, send
an email to EmailAdmin@toysrus.com. 
Toys "R" Us, Inc.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message