How do I use postgresql with camunda

I changed the jdbc settings in server.xml and download the driver postgresql-42.2.2.jar and put it under lib directory. But I cannot logged in with demo/demo. What else need to change?

the error log in catalina.log:
java.sql.SQLException: Unable to load class: org.postgresql.Driver from ClassLoader:java.net.URLClassLoader@5fd0d5ae;ClassLoader:java.net.URLClassLoader@5fd0d5ae

Hi @loserlovey,

Here’s my steps for Wildfly edition:

  • In PostgreSQL Server, create the Camunda engine database “Camunda” (if you want to run it there instead of H2 DB). Grant the user (e.g. the default “postgres” user) DELETE, INSERT, SELECT, and UPDATE privileges in this database. Camunda provides script files to create the schemas. These reside in the sql/create folder:
    ~\camunda-bpm-wildfly10-7.7.0\sql\create\postgres_engine_7.7.0.sql
    ~\camunda-bpm-wildfly10-7.7.0\sql\create\postgres_identity_7.7.0.sql
    Run these two scripts in the created database.

  • Create any application/business database, e.g. “MyAppDataDB”. Grant the user (e.g. the default “postgres” user) DELETE, INSERT, SELECT, and UPDATE privileges in this database.

  • Download jdbc driver and put the .jar file under “~\camunda-bpm-wildfly10-7.7.0\server\wildfly-10.1.0.Final\modules\system\layers\base\org\postgresql\main” (if folders don’t exist, create them).

  • In that folder create a “module.xml” file (“resource-root path” has the name of the jar file):

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-42.1.4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module> 
  • The JDBC driver (.jar file) should also be added as a dependency into the process application project (the one we implement in IDE). We can do that by putting the file under ~\src\main\webapp\WEB-INF\lib folder.
  • Finally, edit the “standalone.xml” file of the Camunda BPM distribution (found under ~\camunda-bpm-wildfly10-7.7.0\server\wildfly-10.1.0.Final\standalone\configuration).
    In <subsystem xmlns="urn:jboss:domain:datasources:4.0"> add the driver, edit the ProcessEngine datasource or add a new application datasource:
<drivers>
…
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
<datasource jta="true" jndi-name="java:jboss/datasources/ProcessEngine" pool-name="ProcessEngine" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:postgresql://[host_ip_address_of_DB_server]:5432/Camunda</connection-url>
<driver>postgresql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<security>
<user-name>postgres</user-name>
<password>****</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
</datasource>
3 Likes

thank you very much for the detailed steps. I finally found that I put the driver into the wrong folder. It should be put in camunda-bpm-tomcat-7.8.0\server\apache-tomcat-8.0.47\lib, rather than camunda-bpm-tomcat-7.8.0\lib

Hello could you please tell me steps
how can we install camunda with postgresql…it means how can we change the H2 database to postgresql…