cancel
Showing results for 
Search instead for 
Did you mean: 

Working with H2 database

koteswarrao
Champ in-the-making
Champ in-the-making
Hi
i am new to H2 database and to activiti as well.
now we are in design phase of our prject and wants to decide which workflow should we use.
i am developing some prototype application to verify whether activiti fits to my project.
i wanted to connect to H2 database without any server support, i configured it through "activiti.cfg.xml" file. but i am unable to connect to database and work on it.
can you please post me the clear steps of how to work as a standalone system and how to persist my workflow states in the database

thanks&regards
Koteswar Rao
9 REPLIES 9

jbarrez
Star Contributor
Star Contributor
The easiest is to use the H2 database that is used in the demo setup.

Check the userguide how you can access it : http://activiti.org/userguide/index.html#inspecting.database

koteswarrao
Champ in-the-making
Champ in-the-making
hi jbarrez
thankyou for the quick reply. i tried to looking into it and i found only the following things in it and moreover i dont want to depend on apache tomcat server, i just want to work as a standalone JAVA application(like simple java program with database connectivity).
can you please guide me on this, because my project is in design phase now and i have to decide whether we can proceed development with activiti or not  and i need to give presentation next week to my Teamlead on this

here i am attaching the sample H2 database web console(you can notice that, what all things i am able to visualise through H2 console, this is working only when i build it using ant demo.start)
thanks
Koteswar Rao

jbarrez
Star Contributor
Star Contributor
You don't need the whole demo setup, you could just use the h2 start/stop scripts, without starting the tomcat server.

koteswarrao
Champ in-the-making
Champ in-the-making
hi jbarrez


this is the total summary of my approach

first i downloaded activiti designer plugins using "eclipse s/w updates" then i created Activiti project and included all the actviti jars through "eclipse build path". after creation of project these are the folders which i found in my package explorer
i attached the file with name "package_explorer". there is nothing inside "src/test/resources".

then i tried programing for the workflow using following snippet

package org.activiti;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;

public class SampleTask
{
private static ProcessEngine processEngine;
public static void main(String[] args)
{

if(processEngine==null)
{
ProcessEngine processEngine=ProcessEngineConfiguration.createStandaloneProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
}

System.out.println("processengine"+processEngine.getName());
}

}


then i am getting following error "actviti.cfg.xml" file not found
if i dont specify the file name and tried building with "createdefaultprocessengine" then i am getting above first said error, which is "database tables are not found"

note: i am not using anything other than these. namely no server, no database installation and all.

jbarrez
Star Contributor
Star Contributor
Try to build a default process engine, and add

.setDatabaseSchemaUpdate(true)

before you call the buildProcessEngine()

koteswarrao
Champ in-the-making
Champ in-the-making
Hi jbarrez
thanks for your support and information. i am able to set up the standalone environment for Activiti with H2 database. Now i would like to proceed with "DB2" database. how can i configure DB2 database? any help is highly appreciated

thanks
Koteswar Rao

frederikherema1
Star Contributor
Star Contributor
This chapter in the userguide should get you on your way: http://activiti.org/userguide/index.html#databaseConfiguration

koteswarrao
Champ in-the-making
Champ in-the-making
hi
ya i tried in that way…but here my DB2 database is a remote system and specified the configuarations as follows

<property name="jdbcUrl" value="jdbc:db2://ipaddressSmiley Tongueortno/ActivitiTEST:retrieveMessagesFromServerOnGetMessage=true;" />
    <property name="jdbcDriver" value="com.ibm.db2.jcc.DB2Driver" />
    <property name="jdbcUsername" value="username" />
    <property name="jdbcPassword" value="password"

but its not working and giving error like 'the name "DB2/NT" cannot be resolved"
what can i do now??

frederikherema1
Star Contributor
Star Contributor
Hi,

This is a known bug in DB2 support (experimental), and will be fixed in 5.4: http://jira.codehaus.org/browse/ACT-681.

As a workaround you could build activiti yourself with modified database mappings