From: | "gauss" <carlga(at)mail(dot)ohusc(dot)k12(dot)in(dot)us> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | JDBC connection - DB Prep? |
Date: | 2000-04-11 12:36:46 |
Message-ID: | s8f2d61f.016@mail.ohusc.k12.in.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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 table created 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 when Linux 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
From | Date | Subject | |
---|---|---|---|
Next Message | Conrad Lawes | 2000-04-11 12:37:16 | Importing a comma-delimited text file |
Previous Message | Keith | 2000-04-11 12:24:27 | Re: PHP-Postgres link |