You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2003/11/15 10:55:40 UTC

cvs commit: jakarta-tomcat-catalina/webapps/docs jndi-datasource-examples-howto.xml

remm        2003/11/15 01:55:40

  Modified:    webapps/docs jndi-datasource-examples-howto.xml
  Log:
  - Remove Tyrex documentation for now.
  
  Revision  Changes    Path
  1.6       +0 -132    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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- jndi-datasource-examples-howto.xml	15 Jan 2003 03:40:43 -0000	1.5
  +++ jndi-datasource-examples-howto.xml	15 Nov 2003 09:55:40 -0000	1.6
  @@ -20,7 +20,6 @@
   <a href="#Introduction">Introduction</a><br />
   <a href="#Database Connection Pool (DBCP) Configurations">
   Database Connection Pool (DBCP) Configurations</a><br />
  -<a href="#Tyrex Connection Pool">Tyrex Connection Pool</a><br />
   <a href="#Non DBCP Solutions">Non DBCP Solutions</a><br />
   <a href="#Oracle 8i with OCI client">Oracle 8i with OCI client</a><br />
   <a href="#Common Problems">Common Problems</a><br />
  @@ -513,137 +512,6 @@
   &lt;/resource-ref&gt;
   </source>
   </subsection>
  -</section>
  -
  -<section name="Tyrex Connection Pool">
  -
  -<subsection name="Introduction">
  -
  -<p>
  -Tomcat 5 provides transaction management and resource configuration support through the use of 
  -<a href="http://tyrex.exolab.org/">Tyrex</a> 1.0. This allows the user to obtain JTA/JCA resources
  -from the JNDI namespace, as well as the standard <code>javax.transaction.UserTransaction</code>.
  -</p>
  -
  -</subsection>
  -
  -<subsection name="Installing Required JARs">
  -
  -<p>
  -In order for a web application to use Tyrex, the webapp and Tomcat need to have access to the 
  -Tyrex jar, as well as the jars it requires.  Here is a list of the required jars, and where to obtain them:
  -</p>
  -<p>
  -The following jars are included with Tyrex binary distribution, available at http://tyrex.exolab.org.
  -
  -<ul>
  -<li>tyrex-1.0.jar</li>
  -<li>ots-jts_1.0.jar</li>
  -<li>jta_1.0.1.jar</li>
  -<li>xerces-J_1.4.0.jar</li>
  -</ul>
  -
  -The following two jars are required as well:
  -
  -<ul>
  -<li>Castor XML jar (<a href="http://castor.exolab.org/">http://castor.exolab.org/</a>, version 0.92 or higher is reccommended)</li>
  -<li>Log4J (<a href="http://jakarta.apache.org/log4j/">http://jakarta.apache.org/log4j/</a>, version 1.0.4 or higher is reccommended)</li>
  -</ul>
  -</p>
  -<p>
  -All six of these jar files need to be placed on $TOMCAT_HOME/common/lib so that both Tomcat and your web application will see them.
  -</p>
  -</subsection>
  -<subsection name="Configuring Tyrex">
  -
  -<p>
  -The Tyrex documentation (http://tyrex.exolab.org) provides complete details on how to properly configure Tyrex.  As an example, we will use the following Tyrex configuration, specified in Tyrex's domain configuration XML file:
  -</p>
  -
  -<source>
  -&lt;domain&gt;
  -  &lt;name&gt;myDomain&lt;/name&gt;
  -  &lt;resources&gt;
  -    &lt;dataSource&gt;
  -      &lt;name&gt;myDatasource&lt;/name&gt;
  -      &lt;jar&gt;/home/david/mm.mysql-2.0.14-bin.jar&lt;/jar&gt;
  -      &lt;class&gt;org.gjt.mm.mysql.jdbc2.optional.MysqlXaDataSource&lt;/class&gt;
  -      &lt;config&gt;
  -        &lt;user&gt;david&lt;/user&gt;
  -        &lt;password&gt;secret&lt;/password&gt;
  -        &lt;serverName&gt;localhost&lt;/serverName&gt;
  -        &lt;port&gt;3306&lt;/port&gt;
  -        &lt;database&gt;daviddb&lt;/database&gt;
  -      &lt;/config&gt;
  -    &lt;/dataSource&gt;
  -  &lt;/resources&gt;
  -&lt;/domain&gt;
  -</source>
  -
  -<p>
  -A few things to note:
  -
  -<ul>
  -<li>You need to specify the full pathname of the JAR file (for relative paths,  Tyrex looks in the current working directory, this usually isn't what you want).  You can also specify a URL.</li>
  -<li>Any elements nested inside the <config></config> elements are passed as parameters to the datasource class, using standard setter methods.</li>
  -<li>More configuration options are available, as well as a better description of how to setup Tyrex, at <a href="http://tyrex.exolab.org/configuration.html">http://tyrex.exolab.org/configuration.html</a></li>
  -</ul>
  -</p>
  -<p>
  -This XML config file needs to be placed where Tomcat's classloader can find it using getResource().  This means that the WEB-INF/classes directory under your webapp is a very good choice.
  -</p>
  -</subsection>
  -
  -<subsection name="Configuring Tomcat">
  -
  -<p>
  -Now that your Tyrex XML config file is in place and ready, you must enlist the Tyrex resources in the JNDI namespace.  This is done through Tomcat's server.xml file. 
  -Two important parameters must be specified: the name of the domain config file (<code>tyrexDomainConfig</code>), and the name of the Tyrex domain that is to be used (<code>tyrexDomainName</code>). 
  -These need to be setup as Environment parameters, like so:
  -</p>
  -<source>
  -&lt;Environment name="tyrexDomainConfig" type="java.lang.String" value="domain-config.xml"/&gt;
  -&lt;Environment name="tyrexDomainName" type="java.lang.String" value="myDomain"/&gt;
  -</source>
  -<p>
  -Now, you must configure the resource (under the &lt;Context&gt; element of your webapp):
  -</p>
  -<source>
  -&lt;Resource name="my-datasource" auth="Container" type="tyrex.resource.Resource"/&gt;
  -&lt;ResourceParams name="my-datasource"&gt;
  -  &lt;parameter&gt;
  -    &lt;name&gt;name&lt;/name&gt;
  -    &lt;value&gt;myDataSource&lt;/value&gt;
  -  &lt;/parameter&gt;
  -&lt;/ResourceParams&gt;
  -</source>
  -<p>
  -A couple of things to point out:
  -<ul>
  -<li>The type of resource should always be <code>tyrex.resource.Resource</code>, regardless of how you have Tyrex configured.</li>
  -<li>Only one ResourceParam parameter is needed, <code>name</code> -- the value should be set to the name of resource specified in the Tyrex config file.</li>
  -<li>Note the difference between a Tomcat/JNDI resource and a Tyrex resource (it can be confusing at first glance!)</li>
  -</ul>
  -</p>
  -</subsection>
  -
  -<subsection name="Coding Your Application">
  -
  -<p>
  -Making use of your Tyrex resource should now be relatively simple.  To obtain your datasource, simply use JNDI:
  -</p>
  -<source>
  -InitialContext initCtx = new InitialContext();
  -DataSource ds = (DataSource) initCtx.lookup("java:comp/env/my-datasource");
  -Connection conn = ds.getConnection();
  -...and so on.
  -</source>
  -<p>
  -Tyrex also provides a <code>javax.transaction.UserTransaction</code>,
  - obtainable through JNDI at the standard location (<code>java:comp/UserTransaction</code>).
  -</p>
  -</subsection>
  -
   </section>
   
   <section name="Non DBCP Solutions">
  
  
  

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