Unknown system variable 'tx_isolation'Connections could not be acquired from the underlying database

前后出现的几个关键错误信息

java.sql.SQLException: Unknown system variable ‘tx_isolation’

java.lang.RuntimeException: java.sql.SQLException: Connections could not be acquired from the underlying database!

Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!

Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.

背景

maven+spring的演示demo

MySQL的版本:
在这里插入图片描述
连接池的datasource的四项配置:
在这里插入图片描述
jdbc的版本:
在这里插入图片描述

问题

运行之后,
首先出现的是这样的错误:

五月 11, 2020 4:26:41 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1bfed88e -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: Unknown system variable 'tx_isolation'
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
	...
	...


java.lang.RuntimeException: java.sql.SQLException: Connections could not be acquired from the underlying database!

	at com.veeja.dao.impl.AccountDaoImpl.findAll(AccountDaoImpl.java:29)
	at com.veeja.service.impl.AccountServiceImpl.findAllAccount(AccountServiceImpl.java:23)
	...
	...
	
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
	at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
	...
	...
	
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
	... 
	...

这个问题,是因为我们的mysql版本太高,而jdbc版本跟不上。
这个时候我们要么把mysql给降级,要么把jdbc给升级,哈哈哈,那还不是废话吗,当然是改一下jdbc的版本,毕竟是maven项目,动动就完事了。

改成:
在这里插入图片描述

然而又出现了这样的错误,关键信息在于java.sql.SQLException: The server time zone value ‘�й���׼ʱ��’ is unrecognized or represents

Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
五月 11, 2020 4:39:58 下午 com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask run
警告: com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@5dcd76d7 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception: 
java.sql.SQLException: The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
	...
	...

我们需要添加一个servertime之类的玩意,稍微做更改:
在这里插入图片描述

试运行:

在这里插入图片描述
成功了。


我套他猴子,一波三折,浪费我甚多时间哪~~

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值