cancel
Showing results for 
Search instead for 
Did you mean: 

Asynchronous Process with DB2

kirek
Champ in-the-making
Champ in-the-making
Hi,
i have a problem with an asynchronous service task.
I built a very simple process..

[attachment=0]process.JPG[/attachment]

..with an asynchronous serviceTask.
The process fails all the time with db2 and throws this exception:  :roll:

### Error querying database.  Cause: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-401, SQLSTATE=42818, SQLERRMC==, DRIVER=3.59.81
### The error may involve org.activiti.engine.impl.persistence.entity.JobEntity.selectExclusiveJobsToExecute-Inline
### The error occurred while setting parameters
### Cause: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-401, SQLSTATE=42818, SQLERRMC==, DRIVER=3.59.81

if I execute the process with h2, it runs without any exceptions..

Can anyone help, please?   Smiley Surprisedops:
3 REPLIES 3

kirek
Champ in-the-making
Champ in-the-making
I found the problem.

There is a bug in the activiti-engine-5.9.jar/org.activiti.db.mapping.entity/job.xml

  <select id="selectExclusiveJobsToExecute" parameterType="map" resultMap="jobResultMap">
    select *
    from ACT_RU_JOB    
    where (RETRIES_ &gt; 0)
      and (DUEDATE_ is null or DUEDATE_ &lt; #{now, jdbcType=TIMESTAMP})
      and (LOCK_OWNER_ is null or LOCK_EXP_TIME_ &lt; #{now, jdbcType=TIMESTAMP})
      and (RETRIES_ &gt; 0)
      and (EXCLUSIVE_ = TRUE)
      and (PROCESS_INSTANCE_ID_ = #{pid}) 
  </select>

This sql tries to compare the EXCLUSIVE_ with "TRUE". But in DB2 "EXCLUSIVE_" is created as a smallint and should be compared with "1" (like oracle)

I fixed the problem by replacing "TRUE" with "1"

meyerd
Champ on-the-rise
Champ on-the-rise
Hi kirek,

Nice catch, would you be willing to attach a patch to ACT-1131 ?

kirek
Champ in-the-making
Champ in-the-making
see more here..

https://jira.codehaus.org/browse/ACT-1131

but only use the attaced file, if you only work with DB2.
The changed Methods are used by every database (excluded oracle), so you cannot
work with other databases anymore.