seata报错:连不上数据库
Spring Cloud seata_0.9.0连接本机MySQL_8.0.27数据库失败,
报错如下:
2022-07-14 20:59:35.968 ERRoR[main]io. seata.core.store.db.LogStoreDataBaseDA0.queryTableStructure:567-query transaction_name size fail,Cannot create PoolableConnectionFactory (Could not create connection to database server.)
原因是数据库驱动连不上,
去你自己的本机Maven仓库下拷贝一个相同版本的数据库连接池
放在/seata/lib下面
修改seata/conf/file.conf
## database store db { ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc. datasource = "druid" ## mysql/oracle/h2/oceanbase etc. db-type = "mysql" driver-class-name = "com.mysql.cj.jdbc.Driver" url = "jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&characterEncoding=utf8&useSSL=false&&serverTimezone=UTC" user = "root" password = "root" min-conn = 1 max-conn = 3 global.table = "global_table" branch.table = "branch_table" lock-table = "lock_table" query-limit = 100 }
再次启动seata/bin/seata-server.bat批处理文件,发现成功
注意:启动seata服务前需要先启动nacos
否则会报:no available server to connect