DbSqlSession isTablePresent method adds table prefix which causes check to fail

Description

We have a MS SQL Server database with windows authentication. We want the Activiti database to go into the 'dbo' schema. I have edited and run the Activiti SQL scripts as appropriate and everything is correctly in the 'dbo' schema.

To get Activiti to use the dbo schema, I configured the SpringProcessEngineConfiguration with the following...

Activiti then correctly prefixes the SQL is executes, for example...

DEBUG o.a.e.i.p.e.P.selectDbSchemaVersion [+] - ==> Preparing: select VALUE_ from dbo.ACT_GE_PROPERTY where NAME_ = 'schema.version'

However, there is then an error when checking for tables

org.activiti.engine.ActivitiException: Activiti database problem: Tables missing for component(s) engine, history, identity
at org.activiti.engine.impl.db.DbSqlSession.dbSchemaCheckVersion(DbSqlSession.java:713)

I have traced this down to the isTablePresent method in DbSqlSession, which appears to create an incorrect metadata call...

To resolve, I overrode the class and commented out this line in the method...
tableName = prependDatabaseTablePrefix(tableName);

This then produces the correct metadata call and Activiti proceeds to work - note the table is NOT prefixed...

I am using 5.11, but this looks the same in your current codebase; line 865 here...
https://github.com/Activiti/Activiti/blob/master/modules/activiti-engine/src/main/java/org/activiti/engine/impl/db/DbSqlSession.java

This is working for me, although I don't like overriding classes, of course. You may wish to put in a proper fix for this somehow.

Environment

None

Assignee

Frederik Heremans

Reporter

James Burton

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure