[jboss-user] [JBoss jBPM] - Re: changing the database as Postgresql

salaboy21 do-not-reply at jboss.com
Wed Aug 13 09:27:42 EDT 2008


Hi! 
it's really easy to do that.. 
if you are working with jbpm-enterprise.ear you must do the following:
Modify the jbpm-enterprise.ear/lib/jbpm-configs.jar/hibernate.cfg.xml file. You have 2 options here:

1) Use a DataSource, provided by JBoss, in this case you must create a data source with your postgre configuration, something like this:
jbpm-ds.xml (it must be called *-ds.xml in order to jboss recognize it *(deploy it) as a data source)

  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>JbpmDS</jndi-name>
  |     <connection-url>jdbc:postgresql://<ip>:5432/JBPM</connection-url>
  |     <driver-class>org.postgresql.Driver</driver-class>
  |     <user-name> <user> </user-name>
  |     <password> <password> </password>
  |         <!-- sql to call when connection is created.  Can be anything, select 1 is valid for PostgreSQL
  |         <new-connection-sql>select 1</new-connection-sql>
  |         -->
  | 
  |         <!-- sql to call on an existing pooled connection when it is obtained from pool.  Can be anything, select 1 is valid for PostgreSQL
  |         <check-valid-connection-sql>select 1</check-valid-connection-sql>
  |         -->
  | 
  |       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml -->
  |       <metadata>
  |          <type-mapping>PostgreSQL 8.0</type-mapping>
  |       </metadata>
  |   </local-tx-datasource>
  | 
  | </datasources>
  | 
And the you must place this file in your /deploy/ directory

2) provide hibernate.cfg.xml the right parameters to connect directly to de database:



  |  <!-- hibernate dialect -->
  | 
  |     <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  | 
  | 
  | 
  |     <!-- JDBC connection properties (begin) ===
  | 
  |     <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
  | 
  |     <property name="hibernate.connection.url">jdbc:hsqldb:mem:jbpm</property>
  | 
  |     <property name="hibernate.connection.username">sa</property>
  | 
  |     <property name="hibernate.connection.password"></property>
  | 
  |     ==== JDBC connection properties (end) -->
  | 
You must uncomment the previous tags and comment the following
 <!-- DataSource properties (begin) -->

    java:/JbpmDS

    <!-- DataSource properties (end) -->

don't forget to change the hibernate dialect to:

  |     <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
  | 

Hope it helps!!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170329#4170329

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170329



More information about the jboss-user mailing list