From: | Cheung Yip San <monitorc(at)netvigator(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Help!Can't connect Postgresql JDBC driver |
Date: | 2000-12-13 15:48:04 |
Message-ID: | 9185nk$eff3@imsp212.netvigator.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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;
}
}
From | Date | Subject | |
---|---|---|---|
Next Message | Oleg Bartunov | 2000-12-13 15:48:40 | index support for arrays (GiST) |
Previous Message | Roderick A. Anderson | 2000-12-13 15:25:41 | Re: info please |