cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to connect activiti BPM 5.22 to standalone H2 database server

rao_diid
Champ on-the-rise
Champ on-the-rise

Hi there,

I am new to Activiti bpm - we are evaluating the product, just starting with it though I have good experience in other BPM products. I am trying to connect activiti BPM to standalone H2 database which I have installed on my machine.

Just to elaborate, I have apache tomcat 8.5.12 up and running with activiti explorer war added to it, have installed latest version of h2 standalone database on my machine and changed jdbc.url property to jdbc:h2:~/activiti .

After It I have restarted H2 and Tomcat, following which I am able to login to activiti explorer with kermit/kermit, but when I login to H2 console I still see a blank database schema with nothing inside it.

Please could someone help/advise what I am doing wrong and how I can connect activiti bpm to stand alone H2 db server.

6 REPLIES 6

gdharley
Elite Collaborator
Elite Collaborator

Are models and processes being persisted after a restart of tomcat?

If so, then you are simply pointing your console to a different database (try searching for an activiti.h2.db file).

If not, then you have the configuration incorrect and are still using an in memory database.

Greg

jearles
Star Contributor
Star Contributor

Pramod,

In my experience this is generally caused by pathing confusions. When you're application, in this case Activiti, utilizes H2 - it creates the local file for the database in the context of the application's location knowledge.
However, I believe - where ever you start the 'h2 console' jar from is referencing its own context. So when trying to connect to an H2 database, I've found that it's generally the easiest to guarantee a connection if you use the full, absolute path of the database location.

Remember, you're able to login and interact with the app, so the database is there - and the console is working but not seeing the database - so it's probably a location issue. If the right DB file is available, those tables will show up - and it isn't available, H2 synthesizes a file where you specified, which is, of course, empty.

Hope this helps,
-JEarles
bp3

rao_diid
Champ on-the-rise
Champ on-the-rise

Thanks Greg and JEarles.

I am able to login to activiti explorer, can see activiti.H2.db file in C:\users\userName directory. Please could you advise what is the url I should use to connect to this database through H2 console.

I am using jdbc:h2:~/activiti as jdbc.url in db.properties file.

Pramod

gdharley
Elite Collaborator
Elite Collaborator

Hi Pramod,

Before we work on the H2 console.

Are you able to see the content of the DB tables in the admin tab of activiti-explorer?

If so, does the content of these tables remain after a restart of Tomcat?

I ask these questions to make sure your db.properties setting are correct and that you aren't dropping and recreating the database on restart (this is an option).

If the above all work as you would expect (i.e. database remains intact after an restart and you can see records in the tables from activiti-explorer) then you should simply need to set the path to the DB file in your H2 console properties.

G

rao_diid
Champ on-the-rise
Champ on-the-rise

I've also tried to use jdbc:h2:file:C:/Users/Admin/activiti as jdbc url in the H2 console, still seeing a blank database. Kindly help/advise if I am doing anything wrong.

Kindly note I have not executed any db creation scripts etc. I have just followed these steps -

1. Change jdbc.url in db.properties from IN MEM database to jdbc:h2:~/activiti.

2. Then I started H2 first.

3. Started Tomcat, able to login to activiti explorer console with kermit/kermit and other users.

4. In the H2 web console gave jdbc url as jdbc:h2:file:C:/Users/Admin/activiti and hit connect.

After doing these steps I just see an empty schema/database. Kindly help/advise to fix this, this would help us evaluate the product.

Thanks,

Pramod

cjose
Elite Collaborator
Elite Collaborator

Why don't you just use the same url jdbc:h2:file:C:/Users/Admin/activiti in db.properties too?