前言
最近项目中需要配置多数据源,在执行查询方法时遇到一个错误Failed to obtain JDBC Connection: dbType not support,记录下解决过程。
正文
问题再现
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: dbType not support : com.alibaba.druid.pool.DruidDataSource, url jdbc:p6spy:mysql://127.0.0.1:3306/Mytest?autoReconnect=true&useSSL=false&characterEncoding=utf-8
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
... 80 common frames omitted
原因
从字面意思上看是数据类型不支持什么东西,是什么呢?
将yaml文件druid 配置的 sql 防火墙(下图中的wall)关掉,问题解决。
总结
记录下这次填坑的的过程,希望给他人带来帮助,可以少踩些坑。