Java
T
point
Home
Core Java
Servlet
JSP
Struts2
Mail API
Hibernate
Spring
Android
Design Pattern
Projects
Interview Q
View All Questions
Ask New Question
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
By:
bvinit***
On:
Sun Nov 06 16:20:40 IST 2016
0
0
0
0
<%@ page import="java.sql.*" import="java.sql.Driver.*"%>
<%
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/vinita","root","root");
String un=request.getParameter("t1");
String pw=request.getParameter("t2");
String q="select password from studentlogin where username=?";
PreparedStatement st=con.prepareStatement(q);
st.setString(1,un);
ResultSet rs=st.executeQuery(q);
rs.next();
if(un.equals(rs.getInt(1)))
{
out.println("welcome"+un);
}
else
{
out.println("invalid credentials");
}
con.close();
}
catch(Exception e){
out.println(e);
}
%>
I have set the classpath correctly and i have loaded mysql-connector.jar and i have set the classpath as C:\Program Files\Java\jre1.8.0_91\lib\ext\mysql-connector.jar;
0
Please add MySql JDBC driver to libary.
0
By:
[email protected]
On:
Tue Nov 15 10:47:15 IST 2016
0
0
0
0
Are You Satisfied :
0Yes
0No