tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brent@VendorSolutions.com" <br...@vendorsolutions.com>
Subject RE: jndi + dbcp [SOLUTION]
Date Tue, 18 Nov 2003 05:36:34 GMT
My problem with the DBCP is that the tomcat manager will not install the
database connection for a pooled datasource.  Each time I add a new
Context or Host, I must stop and restart the entire tomcat app.  This is
not fun and takes more than 5 minutes.  

To install a new app in the manager I use

/manager?path=/website.com?war=file:/path/to/website.com

Each time I do this it starts the web context but without the database
connection.  Any suggestions? Or is there a way to gracefully restart
the tomcat in a multiple virtual domain environment.


THANKS.....


I put the resource link into the context as was mentioned..but still no
luck

<Context path="/website.com" docBase="website.com" debug="0"
reloadable="true" crossContext="false">

<Logger className="org.apache.catalina.logger.FileLogger"
	prefix="localhost_log." suffix=".txt"
	timestamp="true" />

<Valve className="org.apache.catalina.valves.AccessLogValve"
                 directory="webapps/website.com"  prefix="access_log."
suffix=".txt"
                 pattern="combined" resolveHosts="false"/>

          <ResourceLink name="jdbc/myconn"
                        global="myconnDB"
                        type="javax.sql.DataSource"/>

<Resource name="jdbc/myconn" auth="CONTAINER"
type="javax.sql.DataSource" />
<ResourceParams name="jdbc/myconn">
	<parameter>
		<name>factory</name>
	
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
	</parameter>
	<!--set 0 for no limit of max connections-->
	<parameter>
		<name>maxActive</name>
		<value>500000</value>
	</parameter>
	<!--set 0 for no limit idle connections-->
	<parameter>
		<name>maxIdle</name>
		<value>300000</value>
	</parameter>
	<!--max time to wait for connection...and then exception is
thrown (-1 to set indefinitely)-->
	<parameter>
		<name>maxWait</name>
		<value>-1</value>
	</parameter>

	<parameter>
		<name>username</name>
		<value>uname</value>
	</parameter>
	<parameter>
		<name>password</name>
		<value>pass</value>
	</parameter>

	<parameter>
		<name>driverClassName</name>
		<value>com.mysql.jdbc.Driver</value>
	</parameter>

	<!--autoconnect = true means that mm.mysql will automatically
connect if mysql closes the connection.-->
	<!--mysqld automatically closes idle connections after 8
hours.-->
	<parameter>
		<name>url</name>
	
<value>jdbc:mysql://localhost/website:3306/javatest?autoReconnect=true</
value>
	</parameter>
</ResourceParams>
	<Environment name="maxExemptions" type="java.lang.Integer"
                      value="15"/>
          <Parameter name="context.param.name"
value="context.param.value"
                     override="false"/>
          <Resource name="mail/Session" auth="Container"
                    type="javax.mail.Session"/>
          <ResourceParams name="mail/Session">
            <parameter>
              <name>mail.smtp.host</name>
              <value>localhost</value>
            </parameter>
          </ResourceParams>
       
</Context>



-----Original Message-----
From: Christopher Schultz [mailto:christopher.d.schultz@comcast.net] 
Sent: Monday, November 17, 2003 7:38 PM
To: Tomcat Users List
Subject: Re: jndi + dbcp [SOLUTION]


Brent,

> Marc Thanks..!
> 
> Do you know if the global link is necessary...or what it does?

Apparently, GlobalNamingResources is a misnomer. What it really means is

"global pool of available resources". If you want to make one available 
to a Context, you'll need a <ResourceLink> element.

Note that you'll also need a <resource-ref> in your deployment 
descriptor, too!

-chris


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



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