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

Поиск
Список
Период
Сортировка
От Joeseph Blowseph
Тема 'FATAL: database "null" does not exist ' when accessing through a datasource
Дата
Msg-id BAY101-F4078FCE72892E318E5C0A783190@phx.gbl
обсуждение исходный текст
Ответы Re: 'FATAL: database "null" does not exist ' when accessing  (Oliver Jowett <oliver@opencloud.com>)
Список 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 по дате отправления:

Предыдущее
От: Brendan Duddridge
Дата:
Сообщение: Re: Lockup fetching from database
Следующее
От: Oliver Jowett
Дата:
Сообщение: Re: 'FATAL: database "null" does not exist ' when accessing