tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anurag Kapur <anuragka...@gmail.com>
Subject Re: Data Source Resource Declaration in Tomcat Context
Date Wed, 09 Dec 2009 17:51:49 GMT
Thanks Mark.

Can you confirm that I can have one data source "shared" across all contexts
with the following configurations:

In CATALINA_BASE/conf/server.xml, I define a GlobalNamingResource as
follows:

<GlobalNamingResources>
...
...
Resource name=*"@tomcat.context.ece.read.ds.resource@"* auth=*"Container"
type="@tomcat.context.driver.type@" driverClassName=
"@tomcat.context.driver.class@" url="@tomcat.context.db.url@"
connectionProperties=
"{ValidateConnection=@tomcat.context.validate.connection@
,ConnectionWaitTimeout=@tomcat.context.connection.wait.timeout@}" username=
"@tomcat.context.db.user@" password="@tomcat.context.db.password@"
validationQuery="@tomcat.context.validation.query@" initialSize=
"@tomcat.context.initial.size@" minIdle="@tomcat.context.min.idle@"
maxActive="@tomcat.context.max.active@"maxIdle="@tomcat.context.max.idle@"
maxWait="@tomcat.context.max.wait@"removeAbandonedTimeout="60"
removeAbandoned="true" logAbandoned="true"/>*

</GlobalNamingResources>

I then reference it in CATALINA_BASE/conf/context.xml as follows:

<Context>
            <ResourceLink name="@tomcat.context.ece.read.ds.resource@"
            global="@tomcat.context.ece.read.ds.resource@"
            type="@tomcat.context.driver.type@"/>
</Context>

Information obtained from your reply and
http://tomcat.apache.org/tomcat-5.5-doc/config/globalresources.html

Kind Regards

------------------------------------------------------------------
Anurag Kapur
Associate - Technology,
Sapient Corporation.

http://www.linkedin.com/in/anuragkapur

http://www.google.com/profiles/anuragkapur
------------------------------------------------------------------
Sent from Poplar, Greater London, United Kingdom

On Wed, Dec 9, 2009 at 5:16 PM, Mark Thomas <markt@apache.org> wrote:

> Anurag Kapur wrote:
> > Tomcat version: 5.5.27
> > Java version: 1.5.0_14-b03
> >
> > I have a datasource configured in global context (via present in
> > [tomcat_home]/conf/context.xml) as follows:
>
> <snip/>
>
> > I know a DS defined as above is visible across all the contexts defined
> in
> > the container. What I want to know is whether the data source is created
> for
> > "each" context or is it "shared" across all the available contexts?
>
> One DS is created for each context.
>
> If you want a single DS, create it is a global resource and then
> reference the global resource from CATALINA_BASE/conf/context.xml
>
> Mark
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

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