cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Activiti in a environment with Sql Server DB configured with NOCOUNT=ON

denisgmarques
Champ in-the-making
Champ in-the-making
Hello,

We have a particular situation where we install the Activiti in a SQL SERVER 2008 R2 Server Database, which has other systems running. This server is configured with the NOCOUNT = ON attribute by default.

We checked the possibility of leaving the default configuration of SQL SERVER (NOCOUNT OFF), but this was refused by our costumer.

What happens is that somewhere in the code of MyBatis exist a update command (ps.execute()) and after this, if ps.getUpdateCount() was == -1, the Exception "was updated by another transaction concurrently" is showed.

The point is that in SQL Server, NOCOUNT = ON indicates no return the amount of rows affected, so the result always will be "-1".

We try to see if there was a way to set NOCOUNT attribute by user or by DATABASE, but no.

We also tried to verify the possibility to set some attribute in the connection string JDBC driver, but no success.

Someone can help us?

thanks.
2 REPLIES 2

pmsevestre
Champ in-the-making
Champ in-the-making
Have you tried to add a "set nocount = on" to your SQL connection test statement ? Check your datasource pool documentation how can you achieve this. There usually is a setting called "connection check statement" or somehing like this. E.g, in tomcat the property is called "validationQuery".

Hi pmsevestre, following your suggestion, we have solved by adding the following statement to the datasource:

<blockcode>

<new-connection-sql>set nocount off</new-connection-sql>

</blockcode>
Thanks for the tip.

😃