Skip site navigation (1) Skip section navigation (2)

couldn't load DB driver : null

From: "S(dot)A(dot)Pamungkas" <moenk_2000(at)yahoo(dot)com>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: couldn't load DB driver : null
Date: 2000-07-31 11:39:43
Message-ID: 20000731113943.29286.qmail@web4902.mail.yahoo.com (view raw or flat)
Thread:
Lists: pgsql-interfaces
Before, I can connect database both from applet or
servlet.But today, when I try to connect database from
applet or servlet, there was a problem. 

By servlet the error message is : "Couldn't load DB
driver :null".
By applet, in the browser just appear "Connecting to
database ", and in the status bar is a message "Applet
myapplet org/postgresql/jdbc2/Resultset".

Help me please......

The SERVLET code :
import java.io.*;import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class myServlet 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[
            Class.forName("org.postgresql.Driver");
            con =
DriverManager.getConnection("jdbc:postgresql:myDB",
"me", "pass");
            stmt = con.createStatement();
            rs = stmt.executeQuery("select k_id,
k_name, date
from myTable"); 
out.println("<HTML><HEAD><TITLE>KAMOKU</TITLE></HEAD>");
            out.println("<BODY><FONT
COLOR='RED'><H3><BR>TEST
SERVLET & JDBC</H3><BR></FONT>");
            out.println("SELECT id, name, date FROM
kamoku<BR><BR> ");
            out.println("<UL>");    
            while(rs.next()){
                out.println("<LI>" +
rs.getString("k_id")+"  "+
rs.getString("k_name") + "  " + rs.getDate("date"));
            }
            out.println("<UL>");
            out.println("</BODY></HTML>");
        }
        catch(ClassNotFoundException e)
        {
            out.println("Couldn't load DB driver : " +
e.getMessage());
        }
        catch(SQLException e)
        {
            out.println("SQLException caught : " +
e.getMessage());
        }
        finally
        {
            try
            {
                if (con != null) con.close();
            }
            catch (SQLException ignored) { }
        }
    }
}

Thank you.

S.A.Pamungkas

__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/

pgsql-interfaces by date

Next:From: Peter MountDate: 2000-07-31 11:48:25
Subject: RE: couldn't load DB driver : null
Previous:From: Peter MountDate: 2000-07-31 08:36:55
Subject: RE: JDBC driver GREATLY speeded up by trivial fix

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group