cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the default database

mr_mister
Champ in-the-making
Champ in-the-making
Hello everyone!

I'm not familiar with H2, that's why I want to change the default database of Activiti to mysql. I've read in user guide,
http://www.activiti.org/userguide/index.html#inspecting.database
But, you know, the link lead me to index of user guide. That's funny!.

Can anyone help me?
4 REPLIES 4

muraliram
Champ in-the-making
Champ in-the-making
Hi Mr_Mister,

I hope you have configured Activiti and Activiti Explorer is up and running. If thats the case, go to the webapps\activiti-explorer\WEB-INF\classes\db.properties under your tomcat installation (inside your activiti home directory) change the connection paramters to use your mysql. If you want to change the way in activiti-rest interface work, go to webapps\activiti-rest\WEB-INF\classes and edit activiti.cfg.xml. Restart tomcat and your activiti tools should be now pointing to your database. Hope this helps.

Thanks,
MuraliRam

henrik1
Champ in-the-making
Champ in-the-making
Hi,
Thanks! It was very helpful.

In my opinion there should be some information about this in the user guide.
I have used 5.1 and in that version there was separate db files and it was easy to find out how to do it.

/henrik

mr_mister
Champ in-the-making
Champ in-the-making
Thank Muraliram!

I post my technique to change the default database to mysql.
Note: this is working with activity 5.8

Do the following step

- step 01: make sure the file: {activiti-home}/setup/build.db.properties has the contents like below
db=mysql
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/activiti
jdbc.username=root
jdbc.password=password

- step 02: create sql file
just need to duplicate the file h2.data.sql in directory: {activiti-home}/setup/files/demo
and change file name to mysql.data.sql


- step 03(optional): if you want to use the custom tomcat instead of the default tomcat
open the file {activiti-home}/setup/build.properties
look for download.dir entry and change the value to the directory which contains file apache-tomcat-{your-version}.zip

- step 04: copy mysql-connector-java-5.1.6.jar to the listed directory below:

+ {activiti-home}/setup/files/dependencies

and also add this line to file {activiti-home}/workspace/activiti-engine-examples/.classpath
<classpathentry kind="lib" path="libs-runtime/mysql-connector-java-5.1.6.jar"/>
modify the listed text file below to add "mysql-connector-java-5.1.6.jar":
- {activiti-home}/setup/files/dependencie/libs.engine.test.txt
- {activiti-home}/setup/files/dependencie/libs.webapp.explorer.txt
- {activiti-home}/setup/files/dependencie/libs.webapp.rest.txt

- step 05: modify the {activiti-home}/setup/build.xml file
  + looking for the target demo.start and delete(delete or disable are also suitable) the depends: h2.start
  + looking for the target demo.install and comment out the following tags:
    <antcall target="h2.install" />
    <antcall target="h2.start" />
<antcall target="h2.stop" />

- step 06: run ant script demo.start
- step 07:
+ change {activiti-home}/apps/apache-tomcat-6.0.32/webapps/activiti-rest/WEB-INF/classes/activiti.cfg.xml point to mysql

But I suspect step 07 can be omitted by the other ways, maybe change some configuration file in somewhere.

rehan1
Champ in-the-making
Champ in-the-making
you can check this for change h2 database <a href="http://blog.rehanpathan.com/change-database-from-h2-to-mysql-in-activiti/" >change database from h2 to mysql</>