jdbc mysql(wamp服务器)连接问题

时间:2016-04-12 15:18:00

标签: mysql jdbc odbc database-connection wamp

<jsp:include page="page.html"/>
<html>
<head></head>
<body>
<table border="1" width="100%" align="center">
<caption>Job Aspirants</caption>
<tr>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Email-id</th>
    <th>Phone-no</th>
    <th>Mobile-no</th>
    <th>Qualification</th>
    <th>Skills</th>
    <th>City</th>
    <th>Country</th>
</tr>
<%@page import="java.sql.* "%>
<%@page import="java.io.* "%>
<%@page import="java.sql.Connection "%>
<%! String p,m,key,j_id,email,f_name,l_name,q_id,skills,city,country; %>
<%
key=request.getParameter("search");
try
{
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/tests","root",""); //main point of connectivity error
    PreparedStatement pstm=con.prepareStatement(" select * from seek_det where skills='"+key+"' ");
    ResultSet res=pstm.executeQuery();
    while(res.next())
    {
        j_id=res.getString(1);
        email=res.getString(2);
        f_name=res.getString(3);
        l_name=res.getString(4);
        p=res.getString(5);
        m=res.getString(6);
        q_id=res.getString(7);
        skills=res.getString(8);
        city=res.getString(9);
        country=res.getString(10);
        out.println("<tr><td>"+f_name+"</td><td>"+l_name+"</td><td>"+email+"</td><td>"+p+"</td><td>"+m+"</td><td>"+q_id+"</td><td>"+skills+"</td><td>"+city+"</td><td>"+country+"</td></tr>");
    }   

}
catch(SQLException e)
{ 
    out.println("Error of SQL " +e); 
}
catch(ClassNotFoundException e1)
{   out.println("Error of class " +e1); 

}
catch(IOException e2)
{}
%>
</table>
</body>
</html>
尝试与wamp服务器连接时出现jdbc连接错误MySQL数据库我附加了jar文件MySQL jar v5.0.8以及apache tomcat库(这似乎不是问题)

screenshot of database

1 个答案:

答案 0 :(得分:1)

尝试使用URI

  

&#34; JDBC:MySQL的://本地主机:3306 /测试autoReconnect的=真安培; useSSL =假&#34;