java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

第一次在eclipse环境下使用java代码在tomcat服务器上访问mysql数据库遇到的问题

java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

**原因分析:没有将mysql连接数据库的 jar包 放在web项目的 lib 文件夹中

解决方法
1.找到web项目所在文件夹(选中项目,鼠标右键,点击“属性”)
java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

2.找到WEB-INF文件夹
java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

3.进入WEB-INF文件夹找到lib子文件夹
java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

4.将连接数据库的mysql jar包放入lib文件夹,重启tomcat服务器,问题解决。
java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test

成功访问数据库截图
java.sql. SQLException: No suitable driver found for jdbc :mysql://localhost:3306/test