2.6. Configuring a Datasource for JBoss Enterprise Application Platform 6


The default configuration uses embedded databases that are not suitable or supported for production environments. Before deploying into a production environment this configuration must be changed to a supported database.
The following procedure uses a PostgreSQL database as an example.

Procedure 2.4. Configuring a Datasource for JBoss Enterprise Platform 6

  1. Add a directory for the database to the JBoss Enterprise Application Platform 6 directory structure. The directory should be named for the database that will be used. For instance, for a PostgreSQL database create the following structure:
    jboss-eap-6.0/modules/org/postgresql/
    For a MySQL database, create the following structure:
    jboss-eap-6.0/modules/com/mysql/
  2. Download the corresponding JBDC driver for the database.
  3. Create a main directory in the directory created for the database:
    jboss-eap-6.0/modules/org/postgresql/main/
    Copy the JBDC driver into the jboss-eap-6.0/modules/org/postgresql/main/ directory.
  4. Create a module.xml file and save it to jboss-eap-6.0/modules/org/postgresql/main/ with the following content:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.0" name="org.postgresql">
    	<resources>
    		<resource-root path="postgresql-8.4-xxx.jdbc4.jar"/>
    	</resources>
    	<dependencies><module name="javax.api"/></dependencies>
    </module>
    Copy to Clipboard Toggle word wrap
  5. Edit the profile configuration file, for instance, jboss-eap-6.0/standalone/configuration/standalone.xml configured for a PostgreSQL database called jbpmDS, and a user called sa with a password sa:
    <subsystem xmlns="urn:jboss:domain:datasources:1.1">
       <datasources>
          <datasource jta="true" jndi-name="java:jboss/datasources/jbpmDS" pool-name="java:jboss/datasources/jbpmDS_Pool" enabled="true" use-java-context="true" use-ccm="true">
             <connection-url>jdbc:postgresql:mem:test;DB_CLOSE_DELAY=-1</connection-url>
             <driver-class>org.postgresql.Driver</driver-class>
             <driver>postgresql-jdbc4</driver>
             <pool>
                <min-pool-size>2</min-pool-size>
                <max-pool-size>20</max-pool-size>
                <prefill>true</prefill>
             </pool>
             <security>
                <user-name>sa</user-name>
                <password>sa</password>
             </security>
             <validation>
                <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                <validate-on-match>false</validate-on-match>
                <background-validation>false</background-validation>
                <use-fast-fail>false</use-fast-fail>
             </validation>
          </datasource>
          <drivers>
             <driver name="postgresql-jdbc4" module="org.postgresql"/>
          </drivers>
       </datasources>
    </subsystem>
    Copy to Clipboard Toggle word wrap
  6. Edit the jboss-eap-6.0/standalone/deployments/business-central-server.war/WEB-INF/classes/META-INF/persistence.xml file and change the hibernate dialect to PostgreSQL:
    <jta-data-source>java:jboss/datasources/jbpmDS</jta-data-source>
    .
    .
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
    Copy to Clipboard Toggle word wrap
  7. Edit the jboss-eap-6.0/standalone/deployments/jbpm-human-task.war/WEB-INF/classes/META-INF/persistence.xml file and change the hibernate dialect to PostgreSQL:
    <non-jta-data-source>java:jboss/datasources/jbpmDS</non-jta-data-source>
    .
    .				
    <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
    
    Copy to Clipboard Toggle word wrap

返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat