Bug #595: No connection with jdbc since update to 7.2

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bug #595: No connection with jdbc since update to 7.2
Date: 2002-02-18 13:30:40
Message-ID: 200202181330.g1IDUeH42318@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Norbert Pfaff (np(at)tangro(dot)de) reports a bug with a severity of 4
The lower the number the more severe it is.

Short Description
No connection with jdbc since update to 7.2

Long Description
Exception in thread "main" Etwas ungewhnliches ist passiert. Bitte Teilen Sie diesem Fehler mit: Exception: java.lang.NullPointerException
Stack Trace:

java.lang.NullPointerException
at org.postgresql.Connection.openConnection(Unknown Source)
at org.postgresql.Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at TestPostgreSQL.main(TestPostgreSQL.java:84)
End of Stack Trace

at org.postgresql.Driver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:177)
at TestPostgreSQL.main(TestPostgreSQL.java:84)

Sample Code
public class TestPostgreSQL {

public static void main(String argv[]) throws Exception {

// Load the driver class
//
Class.forName("org.postgresql.Driver");

// Try to connect to the DB server.
// We tell JDBC to use the "postgresql" driver
// and to connect to the "template1" database
// which should always exist in PostgreSQL.
// We use the username "postgres" and no
// password to connect. Since we're not accessing
// any tables but only an SQL function
// this should work.
//
Connection conn = DriverManager.getConnection(
"jdbc:postgresql://localhost:5432:template1","postgres","database");

// Set up and run a query that fetches
// the current date using the "now()" PostgreSQL function.
//
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("SELECT now();");

// Iterate through the rows of the result set
// (obviously only one row in this example) and
// print each one.
//
while (rset.next()) {
System.out.println(rset.getString(1));
}

// Close result set, statement and DB connection
//
rset.close();
stmt.close();
conn.close();

}

}

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2002-02-18 17:39:47 Re: Initdb Hangs
Previous Message pgsql-bugs 2002-02-18 11:51:12 Bug #594: postgresql-odbc-7.2-1PGDG.i386.rpm lacks the actual shared library