Home > Archive > PostgreSQL JDBC > January 2006 > 'FATAL: database "null" does not exist ' when accessing through a datasource









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

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

2006-01-14, 3:23 am

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


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com