Emerson,

If you create a file in the META-INF directory called context.xml and have
the contents simular to the following(Change to fit your application. Note
my doc base is absolute. Yours will not be.):

<Context className="org.apache.catalina.core.StandardContext"
cachingAllowed="true"
charsetMapperClass="org.apache.catalina.util.CharsetMapper" cookies="true"
crossContext="true" debug="0" displayName="whatitis"
docBase="/tomcat/tc/webapps/yours"
mapperClass="org.apache.catalina.core.StandardContextMapper" path="/yours"
privileged="false" reloadable="false" swallowOutput="false" useNaming="true"
wrapperClass="org.apache.catalina.core.StandardWrapper">

  <Resource name="jdbc/YourDB" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/YourDB">
      <parameter>
        <name>validationQuery</name>
        <value>select 1</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:mysql://localhost:3306/yours?autoReconnect=true</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>30</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.mysql.jdbc.Driver</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>user</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>password</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
    </ResourceParams>
</Context>

Then place the section in the web.xml as described in the How to and set up
your code as in the how to, it will work fine.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html


TC5 allows the context segment to reside in the .war . This allows anything
that would have been in the server.xml under a context tag to be moved to
this file and be loaded live. I have tested this configuration and it works
great. I later changed to a Global because I could and several of my apps
used the same database.

Doug

----- Original Message ----- 
From: "Emerson Cargnin" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Sent: Thursday, April 22, 2004 1:25 PM
Subject: Re: connection Poll


> 5.0.19.
>
>
>
> Parsons Technical Services wrote:
> > Yes.
> >
> > What version of Tomcat?
> >
> >
> > ----- Original Message ----- 
> > From: "Emerson Cargnin" <[EMAIL PROTECTED]>
> > To: "Tomcat Users List" <[EMAIL PROTECTED]>
> > Sent: Thursday, April 22, 2004 12:52 PM
> > Subject: connection Poll
> >
> >
> >
> >>is there a way to create connection pools per app just with files inside
> >>the .war file? The problem is that I don't access to our internet server
> >>conf file.
> >>
> >>-- 
> >>Emerson Cargnin
> >>Analista de Sistemas
> >>Setor de Desenvolvimento de Sistemas - TRE-SC
> >>tel : (048) - 251-3700 - Ramal 3181
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> -- 
> Emerson Cargnin
> Analista de Sistemas
> Setor de Desenvolvimento de Sistemas - TRE-SC
> tel : (048) - 251-3700 - Ramal 3181
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to