tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shilpa Nalgonda" <snalgo...@mypublisher.com>
Subject configre datasource in server.xml
Date Mon, 09 Aug 2004 19:28:23 GMT
I have configured for datasouce on Tomcat 4.1.03 in
/TOMCAT_HOME/conf/server.xml file.
My application runs fine on my windows desktop.
Now i am in the process of migrating that applicATION ON lINUX MACHINE.  On
Unix, we have apache installed as connector, which routes requests to Tomcat
server.  so whenever we restart tomcat we also restart apache.
Now my question is can i put the datasource configuration under
TOMCAT_HOME/conf/server.xml..
or should i create a new server.xml with just the datasource configuration
under WEB_INF folder.
Below is the configuration which i want to add in server.xml

    <!-- JNDI datasource setup to connect to MYSQL database-->
     	<Context path="/prototype" docBase="prototype"
        	debug="5" reloadable="true" crossContext="true" useNaming="true">

  	<Logger className="org.apache.catalina.logger.FileLogger"
             prefix="localhost_PrototypeDBTest_log." suffix=".txt"
             timestamp="true"/>
       <Resource name="jdbc/prototypedb"
               auth="Container"
               type="javax.sql.DataSource"/>

  	<ResourceParams name="jdbc/prototypedb">
    	<parameter>
      	  <name>factory</name>
      	  <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    	</parameter>

    	<!-- Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->
    	<parameter>
          <name>maxActive</name>
          <value>20</value>
        </parameter>

    	<!-- Maximum number of idle dB connections to retain in pool.
         Set to 0 for no limit.
         -->
        <parameter>
         <name>maxIdle</name>
         <value>10</value>
        </parameter>

   	 <!-- Maximum time to wait for a dB connection to become available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->
    	<parameter>
         <name>maxWait</name>
         <value>10000</value>
        </parameter>

    	<!-- MySQL dB username and password for dB connections  -->
    	<parameter>
     	  <name>username</name>
     	  <value>antonio</value>
    	</parameter>
    	<parameter>
     	  <name>password</name>
     	  <value>play</value>
    	</parameter>

    	<!-- Class name for mm.mysql JDBC driver -->
    	<parameter>
       	  <name>driverClassName</name>
       	  <value>org.gjt.mm.mysql.Driver</value>
    	</parameter>

    	<!-- The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed
the
         connection.  mysqld by default closes idle connections after 8
hours.
         -->
    	<parameter>
      	<name>url</name>

<value>jdbc:mysql://localhost:3306/prototypedb?autoReconnect=true</value>
   	</parameter>
</ResourceParams>
</Context>


---------------------------------------------------------------------
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