Hi:
  I use oracle's JDBC driver oci7 in my Servlet.But the class can't be
loaded. The following is the code:

import java.sql.*;
import java.io.*;
import java.util.Date;
import javax.servlet.*;
import javax.servlet.http.*;

public class SJdbcTest extends HttpServlet {
    public Connection conn=null;
    private int ifload=1;
    private int ifconnect=1;

  public void init(ServletConfig conf) throws ServletException {
        super.init(conf);
       try {
        Class.forName ("oracle.jdbc.driver.OracleDriver");}
        catch (ClassNotFoundException e){ifload=0;}
       try{conn
=DriverManager.getConnection("jdbc:oracle:oci7:","scott","tiger");}
         catch(SQLException e){ifconnect=0;}
       }

 public void doGet(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException
    {  ServletOutputStream out = res.getOutputStream();
       res.setContentType("text/html");
        out.println("<HEAD><TITLE> SJdbcTest </TITLE></HEAD><BODY>");
         out.println("<h1> SJdbcTest </h1>");
        if (ifload==0) out.println("class load failed");
        if(ifconnect==0) out.println("connect failed");
        out.println("</BODY>");
         out.close();
     }
}
   In the browser,I receive 'class load failed' and 'connect
failed',which means that the code 'Class.forName
("oracle.jdbc.driver.OracleDriver")' throw a exception.

  My DBMS is Oracle7.3 ,jdk is 1.1.4.I hope that you can give me any
suggestion about the problom.

Thanks in advanc.
Regards.
HuYong

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to