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><Context></strong></code> or -<code><strong><DefaultContext></strong></code> -elements of the -<a href="config/server.html"><code><strong><Server></strong></code></a> -element. - -The <code><strong><Context></strong></code> element can be specified +<code><strong><Context></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><DefaultContext></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><resource-ref></code> element in the web application deployment descriptor).</li> - -<li> - <a href="config/context.html#Resource Parameters"><ResourceParams></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"><ResourceLink></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"><Context></a> element (to be associated -only with that particular web application) or inside a -<a href="config/defaultcontext.html"><DefaultContext></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><env-entry></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><Host></code> or <code><Engine></code> element.</p> + <code>Context</code> element for this web application.</p> <source> <Context ...> ... <Resource name="bean/MyBeanFactory" auth="Container" - type="com.mycompany.MyBean"/> - <ResourceParams name="bean/MyBeanFactory"> - <parameter> - <name>factory</name> - <value>org.apache.naming.factory.BeanFactory</value> - </parameter> - <parameter> - <name>bar</name> - <value>23</value> - </parameter> - </ResourceParams> + type="com.mycompany.MyBean" + factory="org.apache.naming.factory.BeanFactory" + bar="23"/> ... </Context> </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><Host></code> or <code><Engine></code> element.</p> + <code>Context</code> element for this web application.</p> <source> <Context ...> ... <Resource name="mail/Session" auth="Container" - type="javax.mail.Session"/> - <ResourceParams name="mail/Session"> - <parameter> - <name>mail.smtp.host</name> - <value>localhost</value> - </parameter> - </ResourceParams> + type="javax.mail.Session" + mail.smtp.host="localhost"/> ... </Context> </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><Host></code> or <code><Engine></code> element.</p> + <code>Context</code> element for this web application.</p> <source> <Context ...> ... <Resource name="jdbc/EmployeeDB" auth="Container" - type="javax.sql.DataSource"/> - <ResourceParams name="jdbc/EmployeeDB"> - <parameter> - <name>username</name> - <value>dbusername</value> - </parameter> - <parameter> - <name>password</name> - <value>dbpassword</value> - </parameter> - <parameter> - <name>driverClassName</name> - <value>org.hsql.jdbcDriver</value> - </parameter> - <parameter> - <name>url</name> - <value>jdbc:HypersonicSQL:database</value> - </parameter> - <parameter> - <name>maxActive</name> - <value>8</value> - </parameter> - <parameter> - <name>maxIdle</name> - <value>4</value> - </parameter> - </ResourceParams> + type="javax.sql.DataSource" + username="dbusername" + password="dbpassword" + driverClassName="org.hsql.jdbcDriver" + url="jdbc:HypersonicSQL:database" + maxActive="8" + maxIdle="4"/> ... </Context> </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><Host></code> or <code><Engine></code> element.</p> + <code>Context</code> element for this web application.</p> <source> <Context ...> ... <Resource name="bean/MyBeanFactory" auth="Container" - type="com.mycompany.MyBean"/> - <ResourceParams name="bean/MyBeanFactory"> - <parameter> - <name>factory</name> - <value>com.mycompany.MyBeanFactory</value> - </parameter> - <parameter> - <name>bar</name> - <value>23</value> - </parameter> - </ResourceParams> + type="com.mycompany.MyBean" + factory="com.mycompany.MyBeanFactory" + bar="23"/> ... </Context> </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> - <parameter> - <name>removeAbandoned</name> - <value>true</value> - </parameter> +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> - <parameter> - <name>removeAbandonedTimeout</name> - <value>60</value> - </parameter> + 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> - <parameter> - <name>logAbandoned</name> - <value>true</value> - </parameter> + logAbandoned="true" </source> The default is <code>false</code>. </p> @@ -210,77 +189,39 @@ prefix="localhost_DBTest_log." suffix=".txt" timestamp="true"/> - <Resource name="jdbc/TestDB" - auth="Container" - type="javax.sql.DataSource"/> - - <ResourceParams name="jdbc/TestDB"> - <parameter> - <name>factory</name> - <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> - </parameter> - - <!-- Maximum number of dB connections in pool. Make sure you + <!-- 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. --> - <parameter> - <name>maxActive</name> - <value>100</value> - </parameter> - <!-- Maximum number of idle dB connections to retain in pool. + <!-- 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. --> - <parameter> - <name>maxIdle</name> - <value>30</value> - </parameter> - <!-- Maximum time to wait for a dB connection to become available + <!-- 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. --> - <parameter> - <name>maxWait</name> - <value>10000</value> - </parameter> - - <!-- MySQL dB username and password for dB connections --> - <parameter> - <name>username</name> - <value>javauser</value> - </parameter> - <parameter> - <name>password</name> - <value>javadude</value> - </parameter> - - <!-- 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 - <parameter> - <name>driverClassName</name> - <value>org.gjt.mm.mysql.Driver</value> - </parameter> - --> - - <!-- Class name for the official MySQL Connector/J driver --> - <parameter> - <name>driverClassName</name> - <value>com.mysql.jdbc.Driver</value> - </parameter> + + <!-- username and password: MySQL dB username and password for dB connections --> + + <!-- 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. + --> - <!-- The JDBC connection url for connecting to your MySQL dB. + <!-- 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. --> - <parameter> - <name>url</name> - <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value> - </parameter> - </ResourceParams> + + <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"/> + </Context> </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> <Resource name="jdbc/myoracle" auth="Container" - type="javax.sql.DataSource"/> - -<ResourceParams name="jdbc/myoracle"> - <parameter> - <name>factory</name> - <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> - </parameter> - <parameter> - <name>driverClassName</name> - <value>oracle.jdbc.driver.OracleDriver</value> - </parameter> - <parameter> - <name>url</name> - <value>jdbc:oracle:thin:[EMAIL PROTECTED]:1521:mysid</value> - </parameter> - <parameter> - <name>username</name> - <value>scott</value> - </parameter> - <parameter> - <name>password</name> - <value>tiger</value> - </parameter> - <parameter> - <name>maxActive</name> - <value>20</value> - </parameter> - <parameter> - <name>maxIdle</name> - <value>10</value> - </parameter> - <parameter> - <name>maxWait</name> - <value>-1</value> - </parameter> -</ResourceParams> + type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" + url="jdbc:oracle:thin:[EMAIL PROTECTED]:1521:mysid" + username="scott" password="tiger" maxActive="20" maxIdle="10" + maxWait="-1"/> </source> </p> @@ -434,42 +343,9 @@ <h3>1. server.xml configuration</h3> <source> <Resource name="jdbc/postgres" auth="Container" - type="javax.sql.DataSource"/> - -<ResourceParams name="jdbc/postgres"> - <parameter> - <name>factory</name> - <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> - </parameter> - <parameter> - <name>driverClassName</name> - <value>org.postgresql.Driver</value> - </parameter> - <parameter> - <name>url</name> - <value>jdbc:postgresql://127.0.0.1:5432/mydb</value> - </parameter> - <parameter> - <name>username</name> - <value>myuser</value> - </parameter> - <parameter> - <name>password</name> - <value>mypasswd</value> - </parameter> - <parameter> - <name>maxActive</name> - <value>20</value> - </parameter> - <parameter> - <name>maxIdle</name> - <value>10</value> - </parameter> - <parameter> - <name>maxWait</name> - <value>-1</value> - </parameter> -</ResourceParams> + 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]