报错
打开下载的ssm文件报以下错误
Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is java.sql.SQLException:Connections could not be acquired from the underlying database.
解决方式
在网上搜了很久,说法不一,但很明显是数据源没有连上
首先确认了数据库配置文件里的数据库用户名密码都是对的
数据库也确实建起来了可以单独打开
最后发现是数据库版本问题
我的是mysql8但lib里的jar包是
与我的数据库版本不符
下载了对应版本jar包后
在数据库配置文件(db.properties)中修改driverclass和补全url(mysql8需要时区)
dataSource.driverClass=com.mysql.cj.jdbc.Driver
dataSource.jdbcUrl=jdbc:mysql://localhost:3306/ssm?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
然后就欧克了