Configuring a Different Data Source
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. The most common ones are shown in the xml stanza below.
<bean id="dataSource" init-method="init" destroy-method="close"> <property name="className" value="${rapiddeploy.datasource.classname}"/> <property name="uniqueName" value="dataSource"/> <property name="minPoolSize" value="${rapiddeploy.datasource.pool.size.min}" /> <property name="maxPoolSize" value="${rapiddeploy.datasource.pool.size.max}" /> <property name="allowLocalTransactions" value="true"/> <property name="testQuery" value="select sysdate from dual"/> <property name="driverProperties"> <props> <prop key="user">${rapiddeploy.datasource.username}</prop> <prop key="password">${rapiddeploy.datasource.password}</prop> <prop key="${rapiddeploy.datasource.url.key}">${rapiddeploy.datasource.url}</prop> </props> </property> </bean>
The following properties:
${rapiddeploy.datasource.classname} ${rapiddeploy.datasource.username} ${rapiddeploy.datasource.password} ${rapiddeploy.datasource.url.key} ${rapiddeploy.datasource.url}
refer to properties in the rapidDeploy_default.properties file and should be configured there for your database. The testQuery property is set for Oracle database connectivity and should be changed to an appropriate test for your database :
<property name=�testQuery� value=�select sysdate from dual�/>
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 defined which data source definition is used in the application. There are two files which configure the data source connections, one is a standard data source definition and the other is a JNDI definition. 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 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
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=<DB_USERNAME> rapiddeploy.datasource.password=<DB_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 rapiddeploy.datasource.context.filename=applicationContext-non-jndi-data-source.xml rapiddeploy.datasource.pool.size.min=10 rapiddeploy.datasource.pool.size.max=100 rapiddeploy.datasource.sequence.generator=true
If you use a JNDI data source connection then set the JNDI name in your code$MV_HOME/bin/rapiddeploy.properties/code file:
rapiddeploy.datasource.jndi.name=<APP_CONTAINER_JNDI_NAME>
The JNDI resource must use an XA compliant driver.