I'm not sure if this helps, but for some reason,
Class.forName("postgresql.Driver") is listed but probably should be
Class.forName("org.postgresql.Driver") ... the driver is actually beneath
the org directory. I'm not familar with linux variants of the PostgreSQL
stuff. Sometimes when in doubt, unjar (jar -xvf) the jar files and look at
what's inside. That often times points to problems. Also, always remember
to include jar files in your classpath.
Is there a postgresql.jdbc or postgresql.java mailing list? This probably
belongs there ...
George Johnson
----- Original Message -----
From: "Cheung Yip San" <monitorc@netvigator.com>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, December 13, 2000 7:48 AM
Subject: Help!Can't connect Postgresql JDBC driver
> Could anyone tell me how can I write the applet to connect the
> PostgreSQL?
>
>
> I have installed the Postgresql 7.0.3 RPM on RedHat 6.2 server and try
> to write the applet program to access the database. But the following
> error make me confuse :
>
> java.lang.ClassNotFoundException: java.io.FileNotFoundException:
> http://itdpc27b/~earnest/project/postgresql/Driver.class
>
> I have installed the PSQL 7.0.3 JDBC RPM on the server, I can't see the
> "postgresql.jar" but "jdbc7.0.1-1.jar", "jdbc7.0.1-2.jar".
>
>
> Also, I have tried to run this program from my own desktop PC and on the
> linux server locally, but both are encountered the same error.
>
>
> The following is my program (MyDB.java)
>
> import java.awt.*;
> import java.awt.event.*;
> import java.applet.*;
> import java.sql.*;
>
> public class MyDB extends Applet{
> Connection db;
>
> public void init(){
> try {
> Class.forName("postgresql.Driver");
> String urlStr="jdbc:postgresql://itdpc27b:5432/testdb";
> db=DriverManager.getConnection(urlStr, "earnest", "password");
> } catch (ClassNotFoundException e) {
> e.printStackTrace();
> return;
> }
> catch (SQLException es) {
> System.out.println("SQL Error");
> return;
> }
>
>
> try {
> Statement st = db.createStatement();
> ResultSet rs = st.executeQuery("select * from customer");
> while(rs.next()) {
> System.out.print("Column 1 returned ");
> System.out.println(rs.getString(1));
> }
> rs.close();
> st.close();
> } catch (SQLException es) {
> System.out.println("SQL Error");
> return;
> }
> }
>
>
>