Help!Can't connect Postgresql JDBC driver

Поиск
Список
Период
Сортировка
От Cheung Yip San
Тема Help!Can't connect Postgresql JDBC driver
Дата
Msg-id 9185nk$eff3@imsp212.netvigator.com
обсуждение исходный текст
Список 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;
      }
}



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Postgres failover implementation
Следующее
От: "Schmidt, Peter"
Дата:
Сообщение: RE: Postgres failover implementation