'FATAL: database "null" does not exist ' when accessing through a datasource - Mailing list pgsql-jdbc

From Joeseph Blowseph
Subject 'FATAL: database "null" does not exist ' when accessing through a datasource
Date
Msg-id BAY101-F4078FCE72892E318E5C0A783190@phx.gbl
Whole thread Raw
Responses Re: 'FATAL: database "null" does not exist ' when accessing  (Oliver Jowett <oliver@opencloud.com>)
List pgsql-jdbc
I've set up a datasource to access a database on the local machine. The
database was installed in the default location on the default port. Whenever
I try to make a connection to the database I get an error, usually this one.

org.postgresql.util.PSQLException: FATAL: database "null" does not exist

I've tried every conceivable permuation of the url (and a few inconceivable
ones). The datasource is set up like this:


DataSourceClass:    org.postgresql.ds.PGSimpleDataSource
JNDI Name:                jdbc/PGSimple
URL:                          jdbc:postgresql://localhost:5432/PGSQL1

And the code to access it is like this:

        InitialContext ic = new InitialContext();
    PGSimpleDataSource  PGDS =
        (PGSimpleDataSource) ic.lookup("jdbc/PGSimple);
        Connection PGSimpleConn = PGDS.getConnection();
        /* do Stuff /*
    PGSimpleConn.close();

That code fails with the above error. But if I add this statement, it works
okay:

PGDS.setDatabaseName("PGSQL1");

I can't understand why I can't specify the databasename in the URL.

The container is OC4J running in Oracle Jdeveloper.

Any thoughts would be very much appreciated.

_________________________________________________________________
Are you using the latest version of MSN Messenger? Download MSN Messenger
7.5 today! http://messenger.msn.co.uk


pgsql-jdbc by date:

Previous
From: Brendan Duddridge
Date:
Subject: Re: Lockup fetching from database
Next
From: Oliver Jowett
Date:
Subject: Re: 'FATAL: database "null" does not exist ' when accessing