tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/docs jndi-resources-howto.xml jndi-datasource-examples-howto.xml
Date Thu, 26 Aug 2004 23:16:50 GMT
remm        2004/08/26 16:16:50

  Modified:    webapps/docs jndi-resources-howto.xml
                        jndi-datasource-examples-howto.xml
  Log:
  - Update the JNDI docs after the removal of ResourceParams.
  
  Revision  Changes    Path
  1.7       +24 -91    jakarta-tomcat-catalina/webapps/docs/jndi-resources-howto.xml
  
  Index: jndi-resources-howto.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/jndi-resources-howto.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- jndi-resources-howto.xml	21 Jul 2004 19:24:00 -0000	1.6
  +++ jndi-resources-howto.xml	26 Aug 2004 23:16:50 -0000	1.7
  @@ -30,18 +30,9 @@
   
   <p>For Tomcat 5, these entries in per-web-application 
   <code>InitialContext</code> are configured in the 
  -<code><strong>&lt;Context&gt;</strong></code> or 
  -<code><strong>&lt;DefaultContext&gt;</strong></code>
  -elements of the 
  -<a href="config/server.html"><code><strong>&lt;Server&gt;</strong></code></a>
  -element. 
  -
  -The <code><strong>&lt;Context&gt;</strong></code> element
can be specified 
  +<code><strong>&lt;Context&gt;</strong></code> elements
that can be specified 
   in either <code>$CATALINA_HOME/conf/server.xml</code> or, preferably, 
  -the per-web-application context XML file.
  -
  -<code><strong>&lt;DefaultContext&gt;</strong></code> must
be specified in 
  -<code>$CATALINA_HOME/conf/server.xml</code>.
  +the per-web-application context XML file (either <code>META-INF/context.xml</code>).
   </p>
   
   <p>Tomcat 5 maintains a separate namespace of global resources for the 
  @@ -124,13 +115,6 @@
       application (equivalent to the inclusion of a
       <code>&lt;resource-ref&gt;</code> element in the web application
       deployment descriptor).</li>
  -
  -<li>
  -    <a href="config/context.html#Resource Parameters">&lt;ResourceParams&gt;</a>
-
  -    Configure the Java class name of the resource factory implementation to be
  -    used, as well as JavaBeans properties used to configure that resource
  -    factory.</li>
  -
   <li><a href="config/context.html#Resource Links">&lt;ResourceLink&gt;</a>
-
       Add a link to a resource defined in the global JNDI context. Use resource 
       links to give a web application access to a resource defined in 
  @@ -142,10 +126,7 @@
   
   <p>Any number of these elements may be nested inside a
   <a href="config/context.html">&lt;Context&gt;</a> element (to be associated
  -only with that particular web application) or inside a
  -<a href="config/defaultcontext.html">&lt;DefaultContext&gt;</a> element
  -(used to set the default configuration characteristics for automatically
  -deloyed applications).</p>
  +only with that particular web application).</p>
   
   <p>In addition, the names and values of all <code>&lt;env-entry&gt;</code>
   elements included in the web application deployment descriptor
  @@ -282,24 +263,14 @@
   
       <p>To configure Tomcat's resource factory, add an elements like this to the
       <code>$CATALINA_HOME/conf/server.xml</code> file, nested inside the
  -    <code>Context</code> element for this web application (or nested inside
  -    a <code>DefaultContext</code> element for the surrounding
  -    <code>&lt;Host&gt;</code> or <code>&lt;Engine&gt;</code>
element.</p>
  +    <code>Context</code> element for this web application.</p>
   <source>
   &lt;Context ...&gt;
     ...
     &lt;Resource name="bean/MyBeanFactory" auth="Container"
  -            type="com.mycompany.MyBean"/&gt;
  -  &lt;ResourceParams name="bean/MyBeanFactory"&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;factory&lt;/name&gt;
  -      &lt;value&gt;org.apache.naming.factory.BeanFactory&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;bar&lt;/name&gt;
  -      &lt;value&gt;23&lt;/value&gt;
  -    &lt;/parameter&gt;
  -  &lt;/ResourceParams&gt;
  +            type="com.mycompany.MyBean"
  +            factory="org.apache.naming.factory.BeanFactory"
  +            bar="23"/&gt;
     ...
   &lt;/Context&gt;
   </source>
  @@ -397,20 +368,13 @@
   
       <p>To configure Tomcat's resource factory, add an elements like this to the
       <code>$CATALINA_HOME/conf/server.xml</code> file, nested inside the
  -    <code>Context</code> element for this web application (or nested inside
  -    a <code>DefaultContext</code> element for the surrounding
  -    <code>&lt;Host&gt;</code> or <code>&lt;Engine&gt;</code>
element.</p>
  +    <code>Context</code> element for this web application.</p>
   <source>
   &lt;Context ...&gt;
     ...
     &lt;Resource name="mail/Session" auth="Container"
  -            type="javax.mail.Session"/&gt;
  -  &lt;ResourceParams name="mail/Session"&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;mail.smtp.host&lt;/name&gt;
  -      &lt;value&gt;localhost&lt;/value&gt;
  -    &lt;/parameter&gt;
  -  &lt;/ResourceParams&gt;
  +            type="javax.mail.Session"
  +            mail.smtp.host="localhost"/&gt;
     ...
   &lt;/Context&gt;
   </source>
  @@ -538,40 +502,18 @@
   
       <p>To configure Tomcat's resource factory, add an elements like this to the
       <code>$CATALINA_HOME/conf/server.xml</code> file, nested inside the
  -    <code>Context</code> element for this web application (or nested inside
  -    a <code>DefaultContext</code> element for the surrounding
  -    <code>&lt;Host&gt;</code> or <code>&lt;Engine&gt;</code>
element.</p>
  +    <code>Context</code> element for this web application.</p>
   <source>
   &lt;Context ...&gt;
     ...
     &lt;Resource name="jdbc/EmployeeDB" auth="Container"
  -            type="javax.sql.DataSource"/&gt;
  -  &lt;ResourceParams name="jdbc/EmployeeDB"&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;username&lt;/name&gt;
  -      &lt;value&gt;dbusername&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;password&lt;/name&gt;
  -      &lt;value&gt;dbpassword&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;driverClassName&lt;/name&gt;
  -      &lt;value&gt;org.hsql.jdbcDriver&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;url&lt;/name&gt;
  -      &lt;value&gt;jdbc:HypersonicSQL:database&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;maxActive&lt;/name&gt;
  -      &lt;value&gt;8&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;maxIdle&lt;/name&gt;
  -      &lt;value&gt;4&lt;/value&gt;
  -    &lt;/parameter&gt;
  -  &lt;/ResourceParams&gt;
  +            type="javax.sql.DataSource"
  +            username="dbusername"
  +            password="dbpassword"
  +            driverClassName="org.hsql.jdbcDriver"
  +            url="jdbc:HypersonicSQL:database"
  +            maxActive="8"
  +            maxIdle="4"/&gt;
     ...
   &lt;/Context&gt;
   </source>
  @@ -586,7 +528,7 @@
   
       <p>The configuration properties for Tomcat's standard data source
       resource factory
  -    (<code>org.apache.naming.factory.DbcpDataSourceFactory</code>) are
  +    (<code>org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory</code>) are
       as follows:</p>
       <ul>
       <li><strong>driverClassName</strong> - Fully qualified Java class
name
  @@ -610,6 +552,7 @@
           application.  If specified, this query MUST be an SQL SELECT
           statement that returns at least one row.</li>
       </ul>
  +    <p>For more details, please refer to the commons-dbcp documentation.</p>
   
     </subsection>
   
  @@ -769,24 +712,14 @@
   
       <p>To configure Tomcat's resource factory, add an elements like this to the
       <code>$CATALINA_HOME/conf/server.xml</code> file, nested inside the
  -    <code>Context</code> element for this web application (or nested inside
  -    a <code>DefaultContext</code> element for the surrounding
  -    <code>&lt;Host&gt;</code> or <code>&lt;Engine&gt;</code>
element.</p>
  +    <code>Context</code> element for this web application.</p>
   <source>
   &lt;Context ...&gt;
     ...
     &lt;Resource name="bean/MyBeanFactory" auth="Container"
  -            type="com.mycompany.MyBean"/&gt;
  -  &lt;ResourceParams name="bean/MyBeanFactory"&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;factory&lt;/name&gt;
  -      &lt;value&gt;com.mycompany.MyBeanFactory&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;bar&lt;/name&gt;
  -      &lt;value&gt;23&lt;/value&gt;
  -    &lt;/parameter&gt;
  -  &lt;/ResourceParams&gt;
  +            type="com.mycompany.MyBean"
  +            factory="com.mycompany.MyBeanFactory"
  +            bar="23"/&gt;
     ...
   &lt;/Context&gt;
   </source>
  
  
  
  1.10      +38 -162   jakarta-tomcat-catalina/webapps/docs/jndi-datasource-examples-howto.xml
  
  Index: jndi-datasource-examples-howto.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/jndi-datasource-examples-howto.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- jndi-datasource-examples-howto.xml	11 Aug 2004 18:23:36 -0000	1.9
  +++ jndi-datasource-examples-howto.xml	26 Aug 2004 23:16:50 -0000	1.10
  @@ -57,25 +57,14 @@
   
   <subsection name="Installation">
   <p>DBCP uses the Jakarta-Commons Database Connection Pool. It relies on
  -number of Jakarta-Commons componenets:
  +number of Jakarta-Commons components:
   <ul>
  -<li>Jakarta-Commons DBCP 1.0</li>
  -<li>Jakarta-Commons Collections 2.0</li>
  -<li>Jakarta-Commons Pool 1.0</li>
  +<li>Jakarta-Commons DBCP</li>
  +<li>Jakarta-Commons Collections</li>
  +<li>Jakarta-Commons Pool</li>
   </ul>
  -These jar files along with your the jar file for your JDBC driver should
  -be installed in <code>$CATALINA_HOME/common/lib</code>.
  -<blockquote>
  -<strong>NOTE:</strong>Third Party drivers should be in jarfiles, not zipfiles.
  -Tomcat only adds <code>$CATALINA_HOME/common/lib/*.jar</code> to the classpath.
  -</blockquote>
  -<blockquote>
  -<strong>NOTE:</strong>
  -Do not install these jarfiles in your <code>/WEB-INF/lib</code>, or
  -<code>$JAVA_HOME/jre/lib/ext</code>, or anywhere else.  You will
  -experience problems if you install them anyplace other than
  -<code>$CATALINA_HOME/common/lib</code>.
  -</blockquote>
  +These libraries are located in a single JAR at 
  +<code>$CATALINA_HOME/common/lib/naming-factory-dbcp.jar</code>.
   </p>
   
   </subsection>
  @@ -104,40 +93,30 @@
   
   <p>
   To configure a DBCP DataSource so that abandoned dB connections are
  -removed and recycled add the following <code>paramater</code> to the
  -<code>ResourceParams</code> configuration for your DBCP DataSource
  -<code>Resource</code>:
  -<source>
  -            &lt;parameter&gt;
  -              &lt;name&gt;removeAbandoned&lt;/name&gt;
  -              &lt;value&gt;true&lt;/value&gt;
  -            &lt;/parameter&gt;
  +removed and recycled add the following attribute to the
  +<code>Resource</code> configuration for your DBCP DataSource:
  +<source>
  +            removeAbandoned="true"
   </source>
   When available db connections run low DBCP will recover and recyle
   any abandoned dB connections it finds. The default is <code>false</code>.
   </p>
   
   <p>
  -Use the <code>removeAbandonedTimeout</code> parameter to set the number
  +Use the <code>removeAbandonedTimeout</code> attribute to set the number
   of seconds a dB connection has been idle before it is considered abandoned.
   <source>
  -            &lt;parameter&gt;
  -              &lt;name&gt;removeAbandonedTimeout&lt;/name&gt;
  -              &lt;value&gt;60&lt;/value&gt;
  -            &lt;/parameter&gt;
  +            removeAbandonedTimeout="60"
   </source>
   The default timeout for removing abandoned connections is 300 seconds.
   </p>
   
   <p>
  -The <code>logAbandoned</code> parameter can be set to <code>true</code>
  +The <code>logAbandoned</code> attribute can be set to <code>true</code>
   if you want DBCP to log a stack trace of the code which abandoned the
   dB connection resources.
   <source>
  -            &lt;parameter&gt;
  -              &lt;name&gt;logAbandoned&lt;/name&gt;
  -              &lt;value&gt;true&lt;/value&gt;
  -            &lt;/parameter&gt;
  +            logAbandoned="true"
   </source>
   The default is <code>false</code>.
   </p>
  @@ -210,77 +189,39 @@
                prefix="localhost_DBTest_log." suffix=".txt"
                timestamp="true"/&gt;
   
  -  &lt;Resource name="jdbc/TestDB"
  -               auth="Container"
  -               type="javax.sql.DataSource"/&gt;
  -
  -  &lt;ResourceParams name="jdbc/TestDB"&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;factory&lt;/name&gt;
  -      &lt;value&gt;org.apache.commons.dbcp.BasicDataSourceFactory&lt;/value&gt;
  -    &lt;/parameter&gt;
  -
  -    &lt;!-- Maximum number of dB connections in pool. Make sure you
  +    &lt;!-- maxActive: Maximum number of dB connections in pool. Make sure you
            configure your mysqld max_connections large enough to handle
            all of your db connections. Set to 0 for no limit.
            --&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;maxActive&lt;/name&gt;
  -      &lt;value&gt;100&lt;/value&gt;
  -    &lt;/parameter&gt;
   
  -    &lt;!-- Maximum number of idle dB connections to retain in pool.
  +    &lt;!-- maxIdle: Maximum number of idle dB connections to retain in pool.
            Set to -1 for no limit.  See also the DBCP documentation on this
            and the minEvictableIdleTimeMillis configuration parameter.
            --&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;maxIdle&lt;/name&gt;
  -      &lt;value&gt;30&lt;/value&gt;
  -    &lt;/parameter&gt;
   
  -    &lt;!-- Maximum time to wait for a dB connection to become available
  +    &lt;!-- maxWait: Maximum time to wait for a dB connection to become available
            in ms, in this example 10 seconds. An Exception is thrown if
            this timeout is exceeded.  Set to -1 to wait indefinitely.
            --&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;maxWait&lt;/name&gt;
  -      &lt;value&gt;10000&lt;/value&gt;
  -    &lt;/parameter&gt;
  -
  -    &lt;!-- MySQL dB username and password for dB connections  --&gt;
  -    &lt;parameter&gt;
  -     &lt;name&gt;username&lt;/name&gt;
  -     &lt;value&gt;javauser&lt;/value&gt;
  -    &lt;/parameter&gt;
  -    &lt;parameter&gt;
  -     &lt;name&gt;password&lt;/name&gt;
  -     &lt;value&gt;javadude&lt;/value&gt;
  -    &lt;/parameter&gt;
  -
  -    &lt;!-- Class name for the old mm.mysql JDBC driver - uncomment this entry and
comment next
  -         if you want to use this driver - we recommend using Connector/J though
  -    &lt;parameter&gt;
  -       &lt;name&gt;driverClassName&lt;/name&gt;
  -       &lt;value&gt;org.gjt.mm.mysql.Driver&lt;/value&gt;
  -    &lt;/parameter&gt;
  -     --&gt;
  -    
  -    &lt;!-- Class name for the official MySQL Connector/J driver --&gt;
  -    &lt;parameter&gt;
  -       &lt;name&gt;driverClassName&lt;/name&gt;
  -       &lt;value&gt;com.mysql.jdbc.Driver&lt;/value&gt;
  -    &lt;/parameter&gt;
  +
  +    &lt;!-- username and password: MySQL dB username and password for dB connections
 --&gt;
  +
  +    &lt;!-- driverClassName: Class name for the old mm.mysql JDBC driver is
  +         org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
  +         Class name for the official MySQL Connector/J driver is com.mysql.jdbc.Driver.
  +         --&gt;
       
  -    &lt;!-- The JDBC connection url for connecting to your MySQL dB.
  +    &lt;!-- url: The JDBC connection url for connecting to your MySQL dB.
            The autoReconnect=true argument to the url makes sure that the
            mm.mysql JDBC Driver will automatically reconnect if mysqld closed the
            connection.  mysqld by default closes idle connections after 8 hours.
            --&gt;
  -    &lt;parameter&gt;
  -      &lt;name&gt;url&lt;/name&gt;
  -      &lt;value&gt;jdbc:mysql://localhost:3306/javatest?autoReconnect=true&lt;/value&gt;
  -    &lt;/parameter&gt;
  -  &lt;/ResourceParams&gt;
  +
  +  &lt;Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
  +               maxActive="100" maxIdle="30" maxWait="10000"
  +               username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver"
  +               url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/&gt;
  +
   &lt;/Context&gt;
   </source>
   </p>
  @@ -364,42 +305,10 @@
   <p>Use of the OCI driver should simply involve a changing thin to oci in the URL
string.
   <source>
   &lt;Resource name="jdbc/myoracle" auth="Container"
  -              type="javax.sql.DataSource"/&gt; 
  -
  -&lt;ResourceParams name="jdbc/myoracle"&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;factory&lt;/name&gt;
  -    &lt;value&gt;org.apache.commons.dbcp.BasicDataSourceFactory&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;driverClassName&lt;/name&gt;
  -    &lt;value&gt;oracle.jdbc.driver.OracleDriver&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;url&lt;/name&gt;
  -    &lt;value&gt;jdbc:oracle:thin:myschema@127.0.0.1:1521:mysid&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;username&lt;/name&gt;
  -    &lt;value&gt;scott&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;password&lt;/name&gt;
  -    &lt;value&gt;tiger&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;maxActive&lt;/name&gt;
  -    &lt;value&gt;20&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;maxIdle&lt;/name&gt;
  -    &lt;value&gt;10&lt;/value&gt;
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;maxWait&lt;/name&gt;
  -    &lt;value&gt;-1&lt;/value&gt;
  -  &lt;/parameter&gt;
  -&lt;/ResourceParams&gt;
  +              type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver"
  +              url="jdbc:oracle:thin:myschema@127.0.0.1:1521:mysid"
  +              username="scott" password="tiger" maxActive="20" maxIdle="10"
  +              maxWait="-1"/&gt; 
   </source>
   </p>
   
  @@ -434,42 +343,9 @@
   <h3>1.    server.xml configuration</h3>
   <source>
   &lt;Resource name="jdbc/postgres" auth="Container"
  -          type="javax.sql.DataSource"/> 
  -
  -&lt;ResourceParams name="jdbc/postgres">
  -  &lt;parameter>
  -    &lt;name>factory&lt;/name>
  -    &lt;value>org.apache.commons.dbcp.BasicDataSourceFactory&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>driverClassName&lt;/name>
  -    &lt;value>org.postgresql.Driver&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>url&lt;/name>
  -    &lt;value>jdbc:postgresql://127.0.0.1:5432/mydb&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>username&lt;/name>
  -    &lt;value>myuser&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>password&lt;/name>
  -    &lt;value>mypasswd&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>maxActive&lt;/name>
  -    &lt;value>20&lt;/value>
  -  &lt;/parameter>
  -  &lt;parameter>
  -    &lt;name>maxIdle&lt;/name>
  -    &lt;value>10&lt;/value>
  -  &lt;/parameter&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;maxWait&lt;/name&gt;
  -    &lt;value&gt;-1&lt;/value&gt;
  -  &lt;/parameter&gt;
  -&lt;/ResourceParams&gt; 
  +          type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
  +          url="jdbc:postgresql://127.0.0.1:5432/mydb"
  +          username="myuser" password="mypasswd" maxActive="20" maxIdle="10" maxWait="-1"/>

   </source>
   <h3>2.    web.xml configuration</h3>
   <source>
  
  
  

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


Mime
View raw message