I am trying to get a connection build with JSP and JAVA DERBY Database built in with the NetBeans IDE.
I have checked for the Driver, URL , User and Password everything seems to be perfectly right. The following is the code.
<% Connection con= null;
PreparedStatement ps = null;
ResultSet rs = null;
String driver = "org.apache.derby.jdbc.ClientDriver";
String url = "jdbc:derby://localhost:1527/record";
String user = "root";
String password = "root";
String sql = "select usertype from userdetail";
try
{
Class.forName(driver);
con = DriverManager.getConnection(url, user, password);
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
%>
I end up getting the following (below) error on the browser
type Exception report
message An exception occurred processing JSP page /index.jsp at line 31
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 31
28: String sql = "select usertype from userdetail";
29: try
30: {
31: Class.forName(driver);
32: con = DriverManager.getConnection(url, user, password);
33: ps = con.prepareStatement(sql);
34: rs = ps.executeQuery();
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568
javax.servlet.ServletException: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
Please help! Thank you