JDBC connection - DB Prep? - Mailing list pgsql-general

From gauss
Subject JDBC connection - DB Prep?
Date
Msg-id s8f2d61f.016@mail.ohusc.k12.in.us
Whole thread Raw
List pgsql-general
I have a PGSQL 6.5.2 running on redhat linux and am trying to connect to it from a remote machine.  I have the DB and
tablecreated and can access the table at the console ("pgsql midterm"  midterm=>). 


when I run SimpleExample.class the first three println statments display.  The fourth does not.  I think I have my code
right. How do I verify that Postgresql is accepting connections.  I can "ping" the machine that Posgresql is on. 

I know that postmaster needs to be started with the -i.  How do I verify this with the default installation of PGSQL
whenLinux is installed.  What else do I need to do to prepare the database for connection through JDBC? 

Here is my Java code:

import java.sql.*;

class SimpleExample{
    public static void main(String[] args) {
        System.out.println("before the try");
        try
        {
            String url = "jdbc:postgresql://172.20.50.25/midterm";
            System.out.println("before the Class.forName statement");
            Class.forName("postgresql.Driver");
            System.out.println("before the Connection statement");
            Connection myConnection = DriverManager.getConnection(url, "bryon", "1234");
            System.out.println("Connection is open");

            if (!myConnection.isClosed())
            {myConnection.close();}

        }
        catch (java.lang.Exception ex){}

    }
}

Thanks for the help.
Bryon



pgsql-general by date:

Previous
From: Conrad Lawes
Date:
Subject: Importing a comma-delimited text file
Next
From: "omid omoomi"
Date:
Subject: Re: PHP-Postgres link