The problem is that you don't have the Oracle classes in your classpath.

-ernie

Moloy Biswas wrote:

> Hi all
>
> I need help very badly. Pl respond.
>
> When I am trying to compile my servlet its giving the following error
>
> Class oracle.jdbc.driver.OracleDriver not found.
>
> its pointing to the following line
>
> DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
> // registering the driver
>
> I am attaching my file with this mail, pl respond
>
> 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");
>   DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
>
>                         //Get connection to the database
>                         con = 
>DriverManager.getConnection("jdbc:oracle:oci8:@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());
>                         }
>                 }
>         }
> }
begin:vcard
n:Varitimos;Ernie
tel;cell:781-929-3856
tel;home:781-784-1997
tel;work:781-784-3900
x-mozilla-html:TRUE
url:http://www.skyserver.com
org:Skyserver Consulting, Inc.
adr:;;144 Upland Rd;Sharon;MA;02067;
version:2.1
email;internet:[EMAIL PROTECTED]
title:President
fn:Ernie Varitimos
end:vcard

Reply via email to