'FATAL: database "null" does not exist ' when accessing through a datasource

From: "Joeseph Blowseph" <joseph_blowseph(at)hotmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: 'FATAL: database "null" does not exist ' when accessing through a datasource
Date: 2006-01-14 04:45:50
Message-ID: BAY101-F4078FCE72892E318E5C0A783190@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Oliver Jowett 2006-01-14 11:21:12 Re: 'FATAL: database "null" does not exist ' when accessing
Previous Message Brendan Duddridge 2006-01-13 18:18:58 Re: Lockup fetching from database