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