1. 程式人生 > 其它 >activiti 初始化表 問題:Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table 'activiti_dev.act_ge_property' doesn't exist

activiti 初始化表 問題:Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table 'activiti_dev.act_ge_property' doesn't exist

在學習activiti流程引擎時,將activiti與springboot整合,可以自動部署流程流程,但是我的一直報錯說:Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table 'actspring.act_ge_property',這時候重啟大法也不好用,我又重新看了一遍教程,沒有什麼區別,後來百度該錯誤,找到一條帖子說是因為MySQL版本的問題,MySQL版本8.xxx以後當上會出現該問題,我一看我的pom.xml檔案中沒有寫版本號,看到引入的包預設為8.xxx版本,改成了5.1.6版本,該錯誤解決了

原因
因為mysql使用schema標識庫名而不是catalog,因此mysql會掃描所有的庫來找表,如果其他庫中有相同名稱的表,activiti就以為找到了,本質上這個表在當前資料庫中並不存在。
設定nullCatalogMeansCurrent=true,表示mysql預設當前資料庫操作,在mysql-connector-java 5.xxx該引數預設為true,在6.xxx以上預設為false,因此需要設定nullCatalogMeansCurrent=true。

解決辦法
配置mysql連線時加上:nullCatalogMeansCurrent=true
即:

properties:
useUnicode=true&characterEncoding=utf8 &nullCatalogMeansCurrent=true&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC
xml: ?useUnicode=true&characterEncoding=utf8&nullCatalogMeansCurrent=true&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=UTC

  


原文連結:https://blog.csdn.net/buling_bulink/article/details/116145017