jdbc question - Mailing list pgsql-general

From mr_hopkins@earthlink.net (Micheal H.)
Subject jdbc question
Date
Msg-id 38840cb4.7976208@news.earthlink.net
Whole thread Raw
List pgsql-general
I got the pgsql jdbc drivers and their names were jdbc6.5-1.1.jar and
jdbc6.5-1.2.jar.  OK everything I've read refers to postgresql.jar


I've tried adding the location of the files to the class path as well
as renaming them, one by one to postgresql.jar and adding the file
name to the classpath.  Nothing seems to work.  Now I'm not a java pro
so perhaps something's wrong with my code or my understanding of what
to do with the .jar file(s).   Here's the code.....It compiles but
never gets past "Failed to load postgresql driver".  Would greatly
appreacieate any assistance........

import java.sql.*;

public class SelectApp {
    public static void main(String args[]) {
        String url = "jdbc:postgresql://gina/testdb";

        try {
            Class.forName("postgresql.Driver");
        }
        catch(Exception e) {
            System.out.println("Failed to load postgresql
driver.");
            return;
        }
        System.out.println("Loaded driver successfully");
        try {
            Connection con =
DriverManager.getConnection(url, "", "");
            Statement select = con.createStatement();
            ResultSet result = select.executeQuery("select
* from cities");

            System.out.println("Got results:");
            while(result.next()) { // process results one
row at a time
                int key = result.getInt(1);
                String val = result.getString(2);

                System.out.println("key = " + key);
                System.out.println("val = " + val);
            }
            select.close();
            con.close();
        }
        catch(Exception e) {
            e.printStackTrace();
        }
    }
}


pgsql-general by date:

Previous
From: ANURADHA PAIDARKAR
Date:
Subject: Re: [GENERAL] confusion with vacuum commnad.
Next
From: Mento Chan
Date:
Subject: ...