Received: from www.kpi.com.au (www.kpi.com.au [203.39.132.210]) by hub.org (8.10.1/8.10.1) with ESMTP id e712VNB49313 for ; Mon, 31 Jul 2000 22:31:24 -0400 (EDT) Received: from grail (www.kpi.com.au [203.39.132.210]) by www.kpi.com.au (8.9.3/8.9.3) with SMTP id MAA29929; Tue, 1 Aug 2000 12:33:54 +1000 (EST) (envelope-from shevlandj@kpi.com.au) From: "Joe Shevland" To: "Peter Mount" , "'S.A.Pamungkas'" , Subject: RE: couldn't load DB driver : null Date: Tue, 1 Aug 2000 12:34:31 +1000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1B3D5E532D18D311861A00600865478CF1B195@exchange1.nt.maidstone.gov.uk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by hub.org id e712VQB49347 X-Archive-Number: 200007/239 This is correct; in JServ there's a jserv.properties file with the classpath settings, in Tomcat, you can put the postgresql.jar file under ./webapps//WEB-INF/lib to have it included automatically. Cheers, Joe >-----Original Message----- >From: pgsql-interfaces-owner@hub.org >[mailto:pgsql-interfaces-owner@hub.org]On Behalf Of Peter Mount >Sent: Monday, 31 July 2000 10:22 PM >To: 'S.A.Pamungkas'; pgsql-interfaces@postgresql.org >Subject: RE: [INTERFACES] couldn't load DB driver : null > > >I think servlets don't use CLASSPATH. An alternative is to place the jar >file into the lib/rt directory. That way, it's always available to the JVM >regardless of any classpath setting. > >Peter > >-- >Peter Mount >Enterprise Support >Maidstone Borough Council >Any views stated are my own, and not those of Maidstone Borough Council > > >-----Original Message----- >From: S.A.Pamungkas [mailto:moenk_2000@yahoo.com] >Sent: Monday, July 31, 2000 1:16 PM >To: pgsql-interfaces@postgresql.org >Subject: RE: [INTERFACES] couldn't load DB driver : null > > >Thank you. >But I already put the postgresql.jar file in the >CLASSPATH like this : >export CLASSPATH=.:/usr/local/lib/postgresql.jar > >And, when I try againt ten minutes ago, applet could >connect the database ( by appletviewer ), but servlet >couldn't. > >S.A.Pamungkas > >--- Peter Mount >wrote: >> Looking at your code, the "Couldn't load DB driver" >> message is being >> generated by a ClassNotFound exception being thrown. >> This would indicate >> that the org.postgresql.Driver class is not being >> found in the CLASSPATH. >> That's probably what's going wrong here. >> >> Peter >> >> -- >> Peter Mount >> Enterprise Support >> Maidstone Borough Council >> Any views stated are my own, and not those of >> Maidstone Borough Council >> >> >> -----Original Message----- >> From: S.A.Pamungkas [mailto:moenk_2000@yahoo.com] >> Sent: Monday, July 31, 2000 12:40 PM >> To: pgsql-interfaces@postgresql.org >> Subject: [INTERFACES] couldn't load DB driver : null >> >> >> 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("KAMOKU"); >> out.println("> COLOR='RED'>


TEST >> SERVLET & JDBC


"); >> out.println("SELECT id, name, date FROM >> kamoku

"); >> out.println("
    "); >> while(rs.next()){ >> out.println("
  • " + >> rs.getString("k_id")+" "+ >> rs.getString("k_name") + " " + rs.getDate("date")); >> } >> out.println("
      "); >> out.println(""); >> } >> 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/ > > >__________________________________________________ >Do You Yahoo!? >Kick off your party with Yahoo! Invites. >http://invites.yahoo.com/ >