Error reported in flowable initialization table

Posted by steve490 on Sat, 26 Feb 2022 07:26:41 +0100

When the flowable initializes the table, it always reports an error

mismatch: library version is '6.6.0.0', db version is 5.99.0.0 Hint: Set <property name="databaseSchemaUpdate" to value="true" or value="create-drop" (use create-drop for testing only!) in bean processEngineConfiguration in flowable.cfg.xml for

The database is MySQL
flowable. cfg. The databaseSchemaUpdate configured by XML is create, and the configured database is empty, but this error is always reported
Through searching with the code, it is found that the reason is that nullCatalogMeansCurrent=true is not configured on the database connection. The function of this attribute is to ensure that flowable can automatically create tables and can be built in the correct database, because flowable will go to the database information first when creating tables_ schema. The lookup field in tables is table_ Does name have an ACT_ID_PROPERTY table. If there is, act will be queried_ ID_ Version number of property (because flowable has the function of automatically updating the table structure)
nullCatalogMeansCurrent=true query information_ The sql corresponding to the schema is as follows

SELECT
	TABLE_SCHEMA AS TABLE_CAT,
	NULL AS TABLE_SCHEM,
	TABLE_NAME,
CASE
	
	WHEN TABLE_TYPE = 'BASE TABLE' THEN
CASE
	
	WHEN TABLE_SCHEMA = 'mysql' 
	OR TABLE_SCHEMA = 'performance_schema' THEN
	'SYSTEM TABLE' ELSE 'TABLE' 
END 
WHEN TABLE_TYPE = 'TEMPORARY' THEN
'LOCAL_TEMPORARY' ELSE TABLE_TYPE 
END AS TABLE_TYPE,
	TABLE_COMMENT AS REMARKS,
	NULL AS TYPE_CAT,
	NULL AS TYPE_SCHEM,
	NULL AS TYPE_NAME,
	NULL AS SELF_REFERENCING_COL_NAME,
	NULL AS REF_GENERATION 
FROM
	INFORMATION_SCHEMA.TABLES 
WHERE
	TABLE_SCHEMA = ? 
	AND TABLE_NAME LIKE ? 
HAVING
	TABLE_TYPE IN ( ?,?,?,?,? ) 
ORDER BY
	TABLE_TYPE,
	TABLE_SCHEMA,
TABLE_NAME

When nullCatalogMeansCurrent=true is not configured, it defaults to false to query information_ The sql corresponding to the schema is as follows

SELECT
	TABLE_SCHEMA AS TABLE_CAT,
	NULL AS TABLE_SCHEM,
	TABLE_NAME,
CASE
	
	WHEN TABLE_TYPE = 'BASE TABLE' THEN
CASE
	
	WHEN TABLE_SCHEMA = 'mysql' 
	OR TABLE_SCHEMA = 'performance_schema' THEN
	'SYSTEM TABLE' ELSE 'TABLE' 
END 
WHEN TABLE_TYPE = 'TEMPORARY' THEN
'LOCAL_TEMPORARY' ELSE TABLE_TYPE 
END AS TABLE_TYPE,
	TABLE_COMMENT AS REMARKS,
	NULL AS TYPE_CAT,
	NULL AS TYPE_SCHEM,
	NULL AS TYPE_NAME,
	NULL AS SELF_REFERENCING_COL_NAME,
	NULL AS REF_GENERATION 
FROM
	INFORMATION_SCHEMA.TABLES 
WHERE
	TABLE_NAME LIKE ?
HAVING
	TABLE_TYPE IN ( ?,?,?,?,? ) 
ORDER BY
	TABLE_TYPE,
	TABLE_SCHEMA,
TABLE_NAME

The difference between the above two sql statements is that an additional table is added for true_ SCHEMA = ? Each library is separated by this condition (because multiple flowable databases are built in my local library)
The following is the source code location of splicing this condition


Summary reason: if it is false, it will traverse all databases under the current link for query (because it uses root login). If there are flowable related tables in other databases, it is determined that there is no table missing. Therefore, the table update operation will not be performed. However, when instantiating the object, the relevant data cannot be found, so an error will be reported at startup.

If the database is orcale
application. Note druid in YML configuration file and druid reference in pom. For the flowable configuration, add the specified domain of database schema (that is, the database user name to create the table). When you start the project, you can automatically create a table, but there will be errors. Don't worry at this time. The table has been completely built. Restore the original configuration and remove the database schema.

Cause finding process:

1. In oracle database, when the flowable user has workflow related tables, ftest user initialization fails (automatic table creation fails).

2. Delete the flowable user, and ftest is initialized successfully.

3. Create a new flowable user again and connect with the flowable user. Initialization failed. At the same time, it is found that there is flowable in the yml file Database schema attribute, (interpreted as: In some situations you want to set the schema to use for table checks / generation if the database metadata doesn't return that correctly.). After it is set to flowable, an exception (SQLFeatureNotSupportedException) is thrown at startup. The exception throwing point is com alibaba. druid. pool. DruidPooledConnection. setSchema. Check the Druid source code. When calling setschema, an exception will be thrown unconditionally..

4. Therefore, it can be determined that the current workflow cannot be initialized because of the same reason: there are other initialized users / domains in the database

Topics: MySQL Flowable