6. Configuring Sequoia with 3rd party software

6.1. Forenotes on configuring Sequoia with your application

If the application you are using Sequoia with requires a mapper, the best thing to do is to configure the mapping to be that of Sequoia's underlying databases. For example, if you were using JBoss with PostgreSQL , then using Sequoia on top of the PostgreSQL backends with JBoss would imply to still use the mapping for PostgreSQL while plugging the application server to Sequoia (using Sequoia's driver and Sequoia's url).

6.2. Configuring Sequoia with Jakarta Tomcat

Copy the sequoia-driver.jar file to the lib directory of your web application (for example: $TOMCAT_HOME/webapps/mywebapp/WEB-INF/lib).

There are many ways to obtain connections from a Tomcat application. Just ensure that you are using org.continuent.sequoia.driver.Driver as the driver class name and that the JDBC URL is a Sequoia URL (see Section 5.3, “Sequoia JDBC URL”).

6.3. Configuring Sequoia with JOnAS

The sequoia-driver.jar file must be found in the JOnAS CLASSPATH.

Here is an example of a sequoia.properties file to store in JONAS 3.x conf directory (use the config directory for JOnAS 2.x):

 
        ###################### Sequoia DataSource configuration example # 
        datasource.name      jdbc_1 
        datasource.url       jdbc:sequoia://someMachine/someDatabase 
        datasource.classname org.continuent.sequoia.driver.Driver 
        datasource.username  your-username 
        datasource.password  your-password 
      

6.4. Configuring Sequoia with JBoss

Copy the sequoia-driver.jar file to $JBOSS_DIST/server/default/lib for JBoss 3.x or to $JBOSS_DIST/jboss/lib/ext for JBoss 2.x.

Here is an example of a datasource configuration file to be used with JBoss:

 
        <?xml version="1.0" encoding="UTF-8"?> 
        <!-- ===================================================================== --> 
        <!--                                                                       --> 
        <!-- JBoss Server Configuration                                            -->
        <!--                                                                       --> 
        <!-- ===================================================================== --> 

        <!-- ===================================================================== --> 
        <!-- Datasource config for Sequoia                                          -->
        <!-- ===================================================================== --> 
        <datasources> 
          <local-tx-datasource> 
            <jndi-name>sequoia-DS</jndi-name> 
            <connection-url>jdbc:sequoia://localhost:25322/lscluster</connection-url> 
            <driver-class>org.continuent.sequoia.driver.Driver</driver-class> 
            <user-name>user</user-name> 
            <password>tagada</password> 
          </local-tx-datasource> 
        </datasources> 
      

6.5. Configuring Sequoia with BEA Weblogic Server 7.x/8.x

Place the sequoia-driver.jar file in the classpath of the Weblogic Server.

Here is an example of a connection pool configuration for use with Weblogic:

    <JDBCConnectionPool 
        DriverName="org.continuent.sequoia.driver.Driver"
        InitialCapacity="1"  MaxCapacity="15" 
        Name="sequoiaPool" Properties="user=username;password=password" 
        ShrinkingEnabled="true" SupportsLocalTransaction="true" 
        Targets="wlservername" URL="jdbc:sequoia://192.168.0.1/vdb" 
        XAPreparedStatementCacheSize="0"/>
      

Next, create the required TXDataSources:

        <JDBCTxDataSource EnableTwoPhaseCommit="true" 
          JNDIName="sequoia-DS" Name="Sequoia TX Data Source" 
          PoolName="sequoiaPool" RowPrefetchEnabled="true" Targets="wlservername"/>
      

6.6. Configuring Sequoia with Hibernate

Sequoia just has to be defined as any JDBC driver in Hibernate, leaving the syntax set to the proper database. Here is a configuration example to use Hibernate with a Sequoia cluster made of Sybase backends:

## Sequoia
hibernate.dialect                 net.sf.hibernate.dialect.SybaseDialect
hibernate.connection.driver_class org.continuent.sequoia.driver.Driver
hibernate.connection.username     user
hibernate.connection.password     pass
hibernate.connection.url          jdbc:sequoia://localhost:25322/test        
      

6.7. Using sequences with Hibernate, Sequoia and PostgreSQL

Our Hibernate dialect is as follows:

 
        import net.sf.hibernate.dialect.PostgreSQLDialect; 
        public class SEQUOIAPostgreSQLDialect extends PostgreSQLDialect 
        { 
          public String getSequenceNextValString(String sequenceName) 
          { 
            return "{call nextval('"+sequenceName+"')}"; 
          } 
        } 
      

We simply extend the default PostgreSQL Dialect and override the getSequenceNextValString() method and tell it to use "{call ..." so that all the sequences in the cluster get incremented.

We then changed our Hibernate conf file to user to our custom dialect instead of net.sf.hibernate.dialect.PostgreSQLDialect.