Possible bug in MS-SQL server configuration with schema

Description

Hi all,
when I use this configuration:

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSource"/>
<property name="transactionManager" ref="transactionManager"/>
<property name="databaseSchemaUpdate" value="false"/>
<property name="databaseSchema" value="mySchema"/>
<property name="databaseTablePrefix" value="mySchema."/>
.....
</bean>

I receive this error:
org.activiti.engine.ActivitiException: Activiti database problem: Tables missing for component(s) engine, history, identity

This is because JTDS ( it is my jdbc connector but I investigated also on SQLJDBC which it has the same behaviour)
uses 'sp_tables' system stored procedure when it checks Table Metadata. 'sp_tables' fails because the name of table is changed by :
tableName = prependDatabaseTablePrefix(tableName); (isTablePresent – DbSqlSession - 766).

The use of prependDatabase seems a proper thing but in this case causes the store procedure fails.

On the contrary I can't remove "databaseTablePrefix" because activiti tables are under a not default schema for my db user.
If I remove it Activiti will be not able to find tables.

Possibility fix could be show in attachment file.

Environment

None

Assignee

Frederik Heremans

Reporter

Alfredo Tomarchio

Labels

None

Components

Fix versions

Affects versions

Priority

Major
Configure