Tomcat JDBC Pooling in DataDirect Xquery

This section describes the guidelines for deploying DataDirect XQuery® on an application server running Tomcat 5.x or 6.x.


  • Install DataDirect XQuery® by copying the DataDirect XQuery® jar files to CATALINA_home/common/lib, where CATALINA_home is your Tomcat installation directory.
  • Define your JDBC DataSource resource in CATALINA_home/conf/server.xml

    For example:

    <context path="/DDXQServlet" docBase="DDXQServlet.war">
     <Resource name="jdbc/DDXQExample"
     auth="Container"
     type="javax.sql.DataSource"
     username="john"
     password="topsecret"
     driverClassName="com.ddtek.xquery3.jdbc.XQueryDriver"
     url="jdbc:datadirect:xquery3://jdbcUrl=
     {jdbc:xquery:sqlserver://localhost:1433;databaseName=ddxq_example}"
     initialSize="1"
     accessToUnderlyingConnectionAllowed="true"
     validationQuery="SELECT * FROM FOO" />
    </context>
    


    JDBC DataSource resource configuration options are described later in this section. Note, however, that the accessToUnderlyingConnectionAllowed configuration parameter must be set to "true".

  • Deploy the servlet DDXQServlet.war by copying it into CATALINA_home/webaps.
  • Start Tomcat.
  • Open your Web browser and point it to:

    http://myserver:8080/DDXQServlet/

Tomcat JDBC DataSource Resource Configuration Options

A JDBC DataSource resource can be configured with a number of options. The following table describes settings that are specific to DataDirect XQuery®. Refer to your Tomcat documentation for details.

Parameter

Description

type

Must be javax.sql.DataSource.

username

User name to log on the database.

password

Password to log on the database.

url

Connection URL in the format jdbc:datadirect:xquery3://JdbcUrl={url}[;optionalProperty=value[;...]] See Configuring a Connection Through the JDBC Driver Manager in the DataDirect XQuery User's Guide and Reference for more information.

driverClassName

Must be com.ddtek.xquery3.jdbc.XQueryDriver.

defaultReadOnly

Not supported; do not use.

defaultTransactionIsolation

Cannot be set. In order to change the default transaction isolation, use the appropriate DataDirect XQuery connection property.

defaultCatalog

Cannot be set. In order to change the default catalog, use the appropriate DataDirect XQuery connection property.

validationQuery

See Tomcat documentation. Note that this query can be anything. DataDirect XQuery will ping the database connection to check the connection validity.

poolPreparedStatements

Should not be used in the context of DataDirect XQuery®. Use DataDirect XQuery’s query pooling to maximize performance.

maxOpenPreparedStatements

Should not be used in the context of DataDirect XQuery®. Use DataDirect XQuery's query pooling to maximize performance.

accessToUnderlyingConnectionAllowed

MUST be set to true.

Example

See the Example: JDBC Connection Pooling Servlet for an example of implementing a JDBC connection pool in DataDirect XQuery®.

Prev: "Supported Deployment Environments"

Next: "Deploying on JBoss"