TechnoBuzz

A Techno Blog, mainly about Java

Tomcat 5 contexts definition

In Tomcat 5 , you can define your JNDI  connections in context.xml  and place the file in the /META-INF directory. Alternatively, you can name your context whatever you want by placing your project folder in the webapps directory, and placing a corresponding xml file in \conf\Catalina directory.

For example, I place myfirstapp folder in webapps directory and create myfirstapp.xml inside C:\java\javatools\jakarta-tomcat-5.5.7\conf\Catalina\

The xml file looks as follows:

<!–

    Context configuration file

    $Id: cm.xml,v 1.0 2004/12/21 17:03:34 remm Exp $

–>

<Context docBase="C:\java\javatools\jakarta-tomcat-5.5.7\webapps\myfirstapp\"
         privileged="true" antiResourceLocking="false" antiJARLocking="false">

  <!– Link to the user database we will get roles from –>
  <ResourceLink name="users" global="UserDatabase"
                type="org.apache.catalina.UserDatabase"/>

  <Resource name="jdbc/database" auth="Container"
              type="javax.sql.DataSource" driverClassName="com.ibm.db2.jcc.DB2Driver"
              url="jdbc:db2://server1.myweb.com:50000/staging"
              username="app" password="app1" maxActive="20" maxIdle="10"
              defaultTransactionIsolation="1"/>

   
             

<Resource name="otherds" auth="Container"
                type="javax.sql.DataSource" driverClassName="com.ibm.db2.jcc.DB2Driver"
                url="jdbc:db2://server1.myweb.com:50000/staging:currentSchema=LOCAL;currentFunctionPath=LOCAL;"
                username="app" password="app1" maxActive="20" maxIdle="10"
              defaultTransactionIsolation="1" />

 
               

<Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false">
      <Store className="org.apache.catalina.session.FileStore"/>
</Manager>            

</Context>

Tomcat

Advertisements

January 23, 2006 - Posted by | J2EE

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: