Using Oracle WebLogic datasources with OUAF based products
By ACShorten on Apr 03, 2013
By default, the online (and XAI) components of the Oracle Utilities Application Framework use Universal Connection Pool (or c3p0 for Oracle Utilities Application Framework V2.x) for connection pooling. If you wish to use Oracle WebLogic JDBC based connection pooling for integration to other products or to use the GridLink features of Oracle WebLogic, then Oracle Utilities Application Framework needs to be configured to use Oracle WebLogic datasources.
The following process can be used for this:
- Define the JDBC datasource to the product database, using the Oracle WebLogic console, with the following attributes:
- The JNDI Name for the datasource should contain a directory name such as jdbc. For example, jdbc/demodb. The name of the JNDI should reflect your site requirements.
- Ensure that Global Transaction Support is disabled on the JDBC connection. This is not appropriate for this integration.
- The XA JDBC driver may be used but the product does not take advantage of the XA feature set.
- The Instance or Service driver may be used but if there is no site preference use the Service driver.
- The Database User and Password to use should be any database user with read/write access to the product such as CISUSER or SPLUSER. The value can correspond to the value of the DBUSER configuration variable in the ENVIRON.INI, if no site preference exists.
- If your site is using Oracle WebLogic in embedded mode the above change will change the Oracle WebLogic config.xml to add the JDBC resource. To retain changes over upgrade and patches do the following:
- For products using Oracle Utilities Application Framework V2.x, you should copy the config.xml.template (or config.xml.win.template for Windows) in the etc directory and create a cm version (add cm. as the name prefix) and add the following lines:
Note: The values for name, target and descriptor-file-name tags should be altered to suit your JDBC connection. The internal-apps-deploy-on-demand-enabled is not required but is included for sequence reference purposes.
For products using Oracle Utilities Application Framework V4.x then the above XML code should be placed in the cm_config.xml.exit_3.include file (or CM_config.xml.win.exit_3.include for Windows) in the templates directory. This is using the new user exit method introduced in Oracle Utilities Application Framework V4.x which avoids the need for a cm template altogether.
- To use the new JDBC datasource for online the following must be performed:
- Copy the hibernate.properties.web.tempate to cm.hibernate.properties.web.tempate within the relevant directory. For Oracle Utilities Application Framework V2.x the directory is the etc subdirectory, and Oracle Utilities Application Framework V4.x the directory is the template subdirectory. This will tell the utilities to override the base template with the custom template.
- Add the following lines to the top of the cm template file:
hibernate.connection.datasource = <jdbc_jndi>
hibernate.connection.username = <jndi_user>
hibernate.connection.password = <jndi_user_password>
<jdbc_jndi> - Full JNDI name for the JDBC connection
<jndi_user> - A user to access the JNDI (Substitution variable @WEB_WLSYSUSER@ can be used in the template).
<jndi_user_password> - The password for the user to access the JNDI (Substitution variable @WEB_WLSYSPASS@ can be used in the template).
- Remove the following lines from the cm template file depending on the version of the Oracle Utilities Application Framework:
Framework Version Lines to remove 2.2.x, 4.0.x All hibernate.connection.url entries including any ifdef statements
All hibernate.c3p0.* entries
4.1.x, 4.2.x All hibernate.connection.url entries including any ifdef statements
All hibernate.ucp.* entries
- Change the hibernate.transaction.factory_class setting to org.hibernate.transaction.JDBCTransactionFactory
- Change the hibernate.connection.provider_class to org.hibernate.connection.DatasourceConnectionProvider
- Save the file. For Oracle Utilities Application Framework V4.2 and above the sample cm template is shown below:
hibernate.connection.driver_class = @DBDRIVER@
hibernate.connection.datasource = jdbc/demodb
hibernate.connection.username = @WEB_WLSYSUSER@
hibernate.connection.password = @WEB_WLSYSPASS@
hibernate.dialect = @DIALECT@
hibernate.show_sql = false
hibernate.max_fetch_depth = 2
hibernate.transaction.factory_class = org.hibernate.transaction.JDBCTransactionFactory
hibernate.jdbc.fetch_size = 100
hibernate.jdbc.batch_size = 30
hibernate.query.factory_class = org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory
hibernate.cache.use_second_level_cache = false
hibernate.query.substitutions = true 'Y', false 'N'
- Execute the initialSetup[.sh] command to apply the changes and new templates.
Note: For products using the Oracle Utilities Application Framework V4.x you can execute the initialSetup[.sh] –t command to apply the changes. This avoids an EAR rebuild.
- Restart the server to verify the connection is active
Now the data source is used from Oracle WebLogic for online as well as XAI. This technique does not apply to batch as Oracle WebLogic is not used for batch, this will continue to use UCP or c3p0 (depending on the version of Oracle Utilities Application Framework is used).