Configuring a Datasource

Changing the default datasource

1. Initial Configuration

MidVision's Application Release Automation tool, RapidDeploy, comes initially configured to run in Tomcat, using an internal DataSource connection. This connection is flexible and allows you to set a number of parameters. You can change the database connection settings in the ${MV_HOME}/bin/rapiddeploy.properties file. The example stanza is given here:

                #---------------------------------
                # HSQL Database
                #---------------------------------
                rapiddeploy.datasource.username=sa
                rapiddeploy.datasource.password=sa
                rapiddeploy.datasource.url=jdbc:hsqldb:hsql://localhost:9001/rapiddeploydb
                rapiddeploy.datasource.dialect=org.hibernate.dialect.HSQLDialect
                rapiddeploy.datasource.classname=org.hsqldb.jdbc.pool.JDBCXADataSource
                rapiddeploy.datasource.url.key=url
                rapiddeploy.datasource.schema=sa
                rapiddeploy.quartz.driverDelegateClass=org.quartz.impl.jdbcjobstore.HSQLDBDelegate
                #---------------------------------
                # JNDI settings
                #---------------------------------
                rapiddeploy.datasource.context.filename=applicationContext-non-jndi-data-source.xml
                #rapiddeploy.datasource.context.filename=applicationContext-jndi-data-source.xml
                #rapiddeploy.datasource.jndi.name=jdbc/rapiddeploy
              

You configure the connection pool settings in the file referred to by the rapiddeploy.datasource.context.filename property. This property refers to the file to use in the RapidDeploy WEB-INF directory. In the default case it is: ${MV_HOME}/web-apps/tomcat/webapps/MidVision/WEB-INF/applicationContext-non-jndi-data-source.xml

2. Using JNDI for Container Managed DataSource

We now need to configure the application to point to the database. There are two ways you can connect to the application database: direct (which is the default) or via JNDI from the application container data source connection.

Properties are used to define which data source definition is used in the application. There are three files which configure the data source connections, two are a standard data source definitions and the other is a JNDI definition.  All the files are located at  ${MV_HOME}/web-apps/tomcat/webapps/MidVision/WEB-INF. To determine which file to load you need to add one of these properties to your ${MV_HOME}/bin/rapiddeploy.properties file:

For direct connections and those in the initial configuration described above, use this property value:

rapiddeploy.datasource.context.filename=applicationContext-non-jndi-data-source.xml

or for JNDI connections use this property value:

rapiddeploy.datasource.context.filename=applicationContext-jndi-data-source.xml

for non-JNDI DB2 use this property value:

rapiddeploy.datasource.context.filename=applicationContext-non-jndi-db2-data-source.xml

If you use a direct data source connection and want to change the default HSQL database to use an Oracle database then change the following properties in your ${MV_HOME}/bin/rapiddeploy.properties file:

rapiddeploy.datasource.username=
rapiddeploy.datasource.password=
rapiddeploy.datasource.url=jdbc:oracle:thin:@localhost:1521:xe
rapiddeploy.datasource.dialect=org.hibernate.dialect.Oracle10gDialect
rapiddeploy.datasource.classname=oracle.jdbc.xa.client.OracleXADataSource
rapiddeploy.datasource.url.key=URL
rapiddeploy.quartz.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate

If you use a JNDI data source connection then uncomment and set the JNDI name in your ${MV_HOME}/bin/rapiddeploy.properties file:

rapiddeploy.datasource.jndi.name=

The JNDI resource must use an XA compliant driver.