I am getting error while running a servlet. I am having Oracle 8.0.5 on
Win NT. Compilation of the .java file gives no error .... the error is
** Could not load the database driver: Unable to find class
oracle.jdbc.driver.OracleDriver
Please help
(Attaching the .java file)
Moloy
import java.io.*;
import java.sql.*;
import java.math.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class mservlet1 extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
res.setContentType("text/html");
PrintWriter out = res.getWriter();
try
{
//Load and therefore register the driver
Class.forName("oracle.jdbc.driver.OracleDriver");
//Get connection to the database
con =
DriverManager.getConnection("jdbc:oracle:thin:@sreint:1521:ORCL","moloy","moloy");
//Create a statement object
stmt = con.createStatement();
//Execute an SQL query, get a ResultSet
rs = stmt.executeQuery("SELECT FNAME,LNAME FROM CONTACT");
//Display the result set as a list
out.println("<HTML><HEAD><TITLE>Moloy's
list...</TITLE></HEAD>");
out.println("<BODY><UL>");
while(rs.next())
{
out.println("<LI>" + rs.getString("fname") + " " +
rs.getString("lname"));
}
out.println("</UL>");
out.println("</BODY></HTML>");
}
catch (ClassNotFoundException e)
{
out.println("Could not load the database driver: " +
e.getMessage());
}
catch (SQLException e)
{
out.println("SQLException caught: " + e.getMessage());
}
finally
{
//Close all database connection.
try
{
if (con != null)
con.close();
}
catch (SQLException e)
{
out.println("SQLException caught: " + e.getMessage());
}
}
}
}