No suitable driver found for jdbc:mysql
场景:no suitable driver found for jdbc:mysql//localhost:3306/.
no suitable driver found for jdbc:mysql//localhost:3306/..
no suitable driver found for jdbc:mysql//localhost:3306/..
出现这样的情况,一般有四种原因:
一:连接URL格式出现了问题(Connection conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX")
二:驱动字符串出错(com.mysql.jdbc.Driver)
三:Classpath中没有加入合适的mysql_jdbc驱动(驱动要和你的数据库版本一致)
四:驱动jar包放的位置不对我遇到的问题是第四类,myeclipse里,运行项目始终报此错!
最后把驱动包mysql-connector-java-5.0.5-bin.jar放到jdk/jre/lib/ext里面,得以解决问题!