cancel
Showing results for 
Search instead for 
Did you mean: 

Mysql error updating variable

daniel123
Champ in-the-making
Champ in-the-making
Hi everybody,

I developed an activiti application that launches an exe on a set of files and all works great but i get a mysql data truncated error setting variables if i run the process again.

I have a windows xp server running activiti 5.13 on tomcat 8, jdk 7, and mysql 5.5.24.


here is the error i get:

Caused by: org.apache.ibatis.exceptions.PersistenceException:
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'TEXT_' at row 1
### The error may involve org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.insertVariableInstance-Inline
### The error occurred while setting parameters### SQL: insert into ACT_RU_VARIABLE (ID_, REV_,     TYPE_, NAME_, PROC_INST_ID_
, EXECUTION_ID_, TASK_ID_, BYTEARRAY_ID_,     DOUBLE_, LONG_ , TEXT_, TEXT2_)  values (     ?,     1,     ?,     ?,     ?,     ?,     ?,     ?,     ?,     ?,
     ?,     ?     )
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'TEXT_' at row 1 at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:150)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)
        at org.activiti.engine.impl.db.DbSqlSession.flushInserts(DbSqlSession.java:538)
        at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:441)

        at org.activiti.engine.impl.interceptor.CommandContext.flushSessions(CommandContext.java:169)
        at org.activiti.engine.impl.interceptor.CommandContext.close(CommandContext.java:116)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:70)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
        at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceById(RuntimeServiceImpl.java:71)
        at org.activiti.explorer.ui.process.listener.StartProcessInstanceClickListener.buttonClick(StartProcessInstanceClickListener.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)

        … 35 more
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'TEXT_' at row 1
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4185)
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4119)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2570)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2731)
        at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2815)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
        at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379)

        at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:41)
        at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:66)
        at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:45)
        at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:100)

        at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:148)
        … 49 more




thanks for any help






3 REPLIES 3

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Daniel,

It seems your variable content is too long. I do not know why because:
ACT_RU_VARIABLE.TEXT_ is varchar(4000). (It should be enough for the most cases).

Could you check your DB table, content of variable which is inserted to get more info?


create table ACT_RU_VARIABLE (
    ID_ varchar(64) not null,
    REV_ integer,
    TYPE_ varchar(255) not null,
    NAME_ varchar(255) not null,
    EXECUTION_ID_ varchar(64),
    PROC_INST_ID_ varchar(64),
    TASK_ID_ varchar(64),
    BYTEARRAY_ID_ varchar(64),
    DOUBLE_ double,
    LONG_ bigint,
    TEXT_ varchar(4000),
    TEXT2_ varchar(4000),
    primary key (ID_)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;

hallo Martin.
It's very strange: the length of the string i try to set is very short (5 or 4 characters).

Could you create simple jUnit test? (Or you can use currently existing one e.g. org.activiti.examples.variables.VariablesTest)
and run it against your mySQL DB?