Hello I am trying to access my database using
jsp. I've tried to use jsp and
servlet but I am having some bizzare errors(I am not going to go into details,those problems are in the serlvets forum). So I've decided to connect to my database directly from the jsp.
Here is one of my jsp page code and the error I am getting:
-----------
<html>
<head>
<title>Accessing data in a database</title>
</head>
<body>
<%@ page import="java.sql.* "%>
<%
try {
// Step 1. Load the
JDBC driver
System.out.println("Getting there");
Class.forName("Sun.jdbc.odbc.JdbcOdbc.Driver");
// Step 2. Create a Connection object
Connection con = DriverManager.getConnection(
"jdbc
dbc:Msql///CoreData/CoreData2000",
"budi", "secret");
System.out.println("got connection");
// Step 4. Use the same Statement object to obtain a ResultSet object
String sql = "SELECT * FROM Project";
Statement s= con.createStatement();;
ResultSet rs = s.executeQuery(sql);
while (rs.next()) {
out.println(rs.getString(1) + " " + rs.getString(2) + "<br>");
}
rs.close();
s.close();
con.close();
}
catch (ClassNotFoundException e1) {
// JDBC driver class not found, print error message to the console
System.out.println(e1.toString());
}
catch (SQLException e2) {
// Exception when executing java.sql related commands, print error message to the console
System.out.println(e2.toString());
}
catch (Exception e3) {
// other unexpected exception, print error message to the console
System.out.println(e3.toString());
}
%>
</body>
</html>
When I open my page through the localhost, the page is all blank and in my
tomcat window I am having this error:
java.lang.ClassNotFoundException: Sun.jdbc.odbc.JdbcOdbc.Driver
Getting there
Can You please tell me why it's doing that or how to solve it. It's a access database in the Microsoft sql server, obdc
Thanks