HELLO ALL......

I'm using RedHat, JDK 1.2, JSDK2.0 and Postgresql.

Before I had no problem to connect database from
servlet. But tonight I have problem when connecting
database from servlet.
Really I don't know why,...help me please..?

The error message is :
javax.servlet.UnavailableException: Couldn't load
database driver at ANYSENSEI1.init(ANYSENSEI1.java:18)
at sun.servlet.ServletLoader.loadServlet
(ServletLoader.java: 102)
at sun.servlet.http.HttpServer.getServlet
(HttpServer.java:330)
at sun.servlet.http.HttpServerHandler.sendResponse
(HttpServerHandler.java:152)
at sun.servlet.http.HttpServerHandler.handleConnection
(HttpServerHandler.java:121)
at sun.servlet.http.HttpServerHandler.run
(HttpServerHandler.java:90)
at java.lang.Thread.run(Thread.java:475)
Servlet not found: any1

This is my servlet code :
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ANYSENSEI1  extends HttpServlet {
  private Connection con = null;
  public void init(ServletConfig config) throws
ServletException {
    super.init(config);
    try {
      // Load the Postgresql Driver
      Class.forName("org.postgresql.Driver");
      con =
DriverManager.getConnection("jdbc:postgresql://133.15.144.14:5432/myDB",
"me", "pass");
    }
    catch (ClassNotFoundException e) {
      throw new UnavailableException(this, "Couldn't
load database driver");
    }
    catch (SQLException e) {
      throw new UnavailableException(this, "Couldn't
get db connection");
    }
  }

  public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    out.println("<HTML><HEAD><TITLE>TABLE of
SENSEI</TITLE></HEAD>");
    out.println("<BODY>");
    HtmlSQLResult result =
      new HtmlSQLResult("update sensei set
email='[EMAIL PROTECTED]' where s_name='Kaneko'", con);

    // Display the resulting output
    out.println("<H3><FONT COLOR='RED'>Table of Sensei
  : </FONT></H3>");
    out.println(result );
    out.println("</BODY></HTML>");
  }
  public void destroy() {
    // Clean up.
    try {
      if (con != null) con.close();
    }
    catch (SQLException ignored) { }
  }
}

Thank you in advance.

Pamungkas

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.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