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