Found interface com.mysql.jdbc.Connection, but class was expected (意思就是期望是个类的,但是却发现的是接口)
项目上遇到一个问题,折腾了好久。
google到的结果:
In mysql-connecter-java-5.0 Statement is a class. in 5.1, it's an interface.
The code you write shouldn't care too much. But if you compile against the new version, then run against the old version, you'll have this problem.
我项目中用的是5.1的版本,而在5.1中Connection 和Statement 为接口,而在5.0版本中为class。将jar包替换为mysql-connecter-java-5.0即可
原文地址:http://blog.163.com/xueling1231989@126/blog/static/10264080720151653746560/