java.sql.SQLException: No suitable driver found for jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.ylz.utils.SqlHelper.getConnection(SqlHelper.java:64)
at com.ylz.utils.SqlHelper.executeQuery3(SqlHelper.java:109)
at com.ylz.service.UserService.checkUser(UserService.java:12)
at com.ylz.actions.LoginAction.execute(LoginAction.java:36)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.ylz.filters.MyFilter1.doFilter(MyFilter1.java:22)
jar包换了n个版本都不行,我的链接oracle数据库没有问题,数据库就是test
追答一:连接URL格式出现了问题(Connection conn=DriverManager.
getConnection("jdbc:mysql://localhost:3306/XX","root","XXXX")
二:驱动字符串出错(com.mysql.jdbc.Driver)
三:Classpath中没有加入合适的mysql_jdbc驱动(驱动要和你的数据库版本一致)
四:驱动jar包放的位置不对
你的jar包一应该是导错了
import java.sql.*;