tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andre Prasetya" <andre.prase...@gmail.com>
Subject Re: Context.xml in tomcat 5.5
Date Thu, 19 Apr 2007 11:09:41 GMT
there are 2 places you can configure the connection pooling
at global and at local. for your case its global. yes it is at
server.xmlbut you have to put an entry at
context.xml so that the web.xml recognise it

example
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment value="30" type="java.lang.Integer" name="simpleValue" />

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource pathname="conf/tomcat-users.xml" description="User database
that can be updated and saved" auth="Container" type="
org.apache.catalina.UserDatabase" name="UserDatabase" factory="
org.apache.catalina.users.MemoryUserDatabaseFactory" />
    <Resource auth="Container"
          description="DB Connection"
          driverClass="com.mysql.jdbc.Driver"
          maxPoolSize="100"
          minPoolSize="1"
          acquireIncrement="1"
          name="jdbc/Standard"
          user="****"
          password="*******"
          factory="org.apache.naming.factory.BeanFactory"
          type="com.mchange.v2.c3p0.ComboPooledDataSource"
          jdbcUrl="jdbc:mysql://127.0.0.1:3306/test?autoReconnect=true" />
  </GlobalNamingResources>

the following entry should be available at context.xml (global or local you
choose)
    <ResourceLink
          name="jdbc/Standard"
          global="jdbc/Standard"
          type="javax.sql.DataSource"/>

then you can put this at your app web.xml
    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/Standard</res-ref-name>
        <res-type>
            javax.sql.DataSource
        </res-type>
        <res-auth>Container</res-auth>
        <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>


On 4/19/07, Avinash Kumar <technoavinash@gmail.com> wrote:
>
> Hi,
> u wrote " ....for example you need a DataSource (connection pool) that is
> shared
> for all application. you can configure a context.xml inside META-INF of
> your
> web app...." if it is shared by all application then sud i configure a
> context.xml inside META-INF of my web app..then ud it  b cogmmon to all
> the
> application.?thne i must write it in the TOMCAT_HOME/conf/context.xml
> ,isn't
> it???
>   Nd one more thing Sir,For configuring Data Source(for pooling) in tomcat
> 5.5 we can configure it in server.xml using JNDI ..then why in
> TOMCAT_HOME/conf/context.xml ?
>
>
> On 4/19/07, Andre Prasetya <andre.prasetya@gmail.com> wrote:
> >
> > the one at TOMCAT_HOME\conf\context.xml is the one that is loaded for
> all
> > application, you ll wanna use that if you have a global environment
> > variable. for example you need a DataSource (connection pool) that is
> > shared
> > for all application. you can configure a context.xml inside META-INF of
> > your
> > web app.
> >
> > On 4/19/07, Avinash Kumar <technoavinash@gmail.com> wrote:
> > >
> > > Hi all,
> > >   Thier is a file TOMCAT_HOME\conf\context.xml in tomcat 5.5 ,what we
> > have
> > > to write in this xml file and when is this file needed,i made two
> sample
> > > web
> > > application in jsp and servets ,i just deployed those in webapps ,i se
> > the
> > > java and tomcat home as required  and these application are running ,i
> > > just
> > > want to know that when we have to configure this file.
> > > Thanks
> > >
> >
> >
> >
> > --
> > -Andre-
> >
> > People see things the way they are and say "why ?" I see things that
> never
> > were and say "Why not ?"
> >
>



-- 
-Andre-

People see things the way they are and say "why ?" I see things that never
were and say "Why not ?"

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