You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by "Kumar, Ashok" <ak...@metatomix.com> on 2001/12/20 19:25:41 UTC

Datasource and multiple access support

Hi,

We have written a new content and descriptor store for slide which we
would
like to submit. This store uses a J2EE Datasource and allows multiple
slide
requests to be processed at the same time.

The Domain.xml file contains the following configuration for the store:

<definition>
<store name="j2ee">
<nodestore classname="slidestore.reference.J2EEDescriptorsStore">
<parameter name="datasource">jdbc/mtx</parameter>
</nodestore>
<securitystore>
<reference store="nodestore"/>
</securitystore>
<lockstore>
<reference store="nodestore"/>
</lockstore>
<revisiondescriptorsstore>
<reference store="nodestore"/>
</revisiondescriptorsstore>
<revisiondescriptorstore>
<reference store="nodestore"/>
</revisiondescriptorstore>
<contentstore classname="slidestore.reference.J2EEContentStore">
<parameter name="datasource">jdbc/mtx</parameter>
</contentstore>
</store>
<scope match="/" store="j2ee"/>
</definition>

In order to use this with Tomcat you need to setup the datasource.
Instructions for this are at
http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.htm
l.
If you follow the above instructions you will make changes similar to
the
following in web.xml and server.xml.

web.xml
 <resource-ref>
  <description>Testing Tomcat-wide datasource usage</description>
  <res-ref-name>jdbc/mtx</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
 </resource-ref>

server.xml
 <DefaultContext debug="99">
  <Resource name="jdbc/mtx" auth="Container"
type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/mtx_system">
   <parameter>
    <name>user</name>
    <value>bar</value>
   </parameter>
   <parameter>
    <name>password</name>
    <value>foo</value>
   </parameter>
   <parameter>
    <name>driverClassName</name>
    <value>com.jnetdirect.jsql.JSQLDriver</value>
   </parameter>
   <parameter>
    <name>driverName</name>
    <value>jdbc:JSQLConnect://localhost/test</value>
   </parameter>
  </ResourceParams>
 </DefaultContext>

A couple of general notes in case you encounter problems. It is
important
that the only jndi.jar, naming.jar and jdbc.jar's and your jdbc driver
are
in the %CATALINA_HOME%/common/libs and/or %CATALINA_HOME%/libs folders.
If
slide loads any of the classes from its own classloder it will either
not
find the tomcat datasource or it will fail to load the DB drivers.

With Tomcat 4.0.1 the standard implementation provides a datasource
which
has pooling. It has no configured limits, it will grow as required and
lazily shrinks to reduce its size (I believe). Tomcat also has the
capability to support other datasource implementations and may offer one
based on the Apache commons DBCP pool implementationin a future release
(maybe someone can clarify this)

We have tested this within our requirements and are using the store with
Tomcat 4.0.1 and Microsoft SQL server on windows 2k using Sun JDK 1.3.1.
Although we dont see any issue with using other DB's or platforms (or
servlet containers) it has not been tested.

 <<J2EEContentStore.java>>  <<J2EEDescriptorsStore.java>> 

Regards Ashok
Metatomix Inc