1 Reply Latest reply on Aug 13, 2008 9:27 AM by Mauricio Salatino

    changing the database as Postgresql

    Mansingh Shitole Newbie

      I want the guide for configuring postgresql DB for JBpm.

      guide is available inside doc,
      but anyone who switched to postgresql then give a thorough steps for integrating postgresql with jbpm

        • 1. Re: changing the database as Postgresql
          Mauricio Salatino Master

          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!!