使用maven搭建SSM时数据连接池出问题了,Could not get JDBC Connection Unknown error 1146。数据源使用的是DBCP。
DBCP配置:
db.properties;
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/taotao?characterEncoding=utf-8
jdbc.username=root
jdbc.password=Zw564897235
引入的Jar包:
控制台错误说明:
DEBUG [http-bio-8080-exec-1] - Could not complete request
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unknown error 1146)
### The error may exist in com/taotao/mapper/TbItemMapper.xml
### The error may involve com.taotao.mapper.TbItemMapper.selectByPrimaryKey
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Unknown error 1146)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy20.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:68)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:52)
前一个月同样的配置是没有问题的,最近想回顾一下这个项目,突然发现数据连接出了问题。可以肯定的是db.properties文件里面是没有错误的,因为我不通过maven搭建的ssm是可以用的。这个问题困扰我好久了,根本不知道从错误信息Unknown error 1146从哪里去入手解决问题。求各位大佬帮忙了!