employee_list.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD><TITLE>Employee List</TITLE></HEAD>
<BODY>
<%@ page import="java.sql.*" %>
<%@ page import="java.lang.ClassNotFoundException" %>
<%
Statement st = null;
ResultSet rs = null;
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/"+"Hibernate MySQL","root","root");
st = conn.createStatement();
rs = st.executeQuery("select * from employees");
while(rs.next()) {
%><TABLE BORDER=1 width="75%">
<TR><TH>Last Name</TH><TH>First Name</TH></TR>
<TR><TD><%= rs.getString("lname_txt") %></TD>
<TD><%= rs.getString("fname_txt") %></TD></TR>
<%
}
%>
</TABLE>
<%
} catch (Exception ex) {
out.println("Error :" + ex);
%>
<%
} finally {
if (rs != null) rs.close();
if (st != null) st.close();
if (conn != null) conn.close();
}
%>
</BODY>
</HTML>
Database name: Hibernate MySQL Table: employees
+--------------+-----------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-----------+------+-----+---------+-------+
| lname_txt | char(50) | YES | | NULL | |
| fname_txt | char(50) | YES | | NULL | |
| employee_num | int(11) | NO | PRI | | |
| address1_txt | char(120) | YES | | NULL | |
| address2_txt | char(120) | YES | | NULL | |
| city | char(50) | YES | | NULL | |
| state | char(2) | YES | | NULL | |
| zip | char(10) | YES | | NULL | |
| phone | char(14) | YES | | NULL | |
+--------------+-----------+------+-----+---------+-------+
Error :java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
Hello I try to execute the above coding i am getting Error :java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
i am using eclipse,tomcat and mysql i cant able to retrive the datas from the table through jsp gudie me to solve the problem
thanks in advance
have a nice time