X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 9EFBB9DD93D for ; Sat, 14 Jan 2006 17:24:05 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 51361-03 for ; Sat, 14 Jan 2006 17:24:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by postgresql.org (Postfix) with ESMTP id B6BFA9DD93B for ; Sat, 14 Jan 2006 17:24:01 -0400 (AST) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1ExssU-00080h-Dv; Sun, 15 Jan 2006 10:24:02 +1300 Message-ID: <43C96BF1.4000407@opencloud.com> Date: Sun, 15 Jan 2006 10:24:01 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joeseph Blowseph CC: pgsql-jdbc@postgresql.org Subject: Re: 'FATAL: database "null" does not exist ' when accessing References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.109 required=5 tests=[AWL=0.109] X-Spam-Score: 0.109 X-Spam-Level: X-Archive-Number: 200601/62 X-Sequence-Number: 14513 Joeseph Blowseph wrote: > The datasource construction parameters are stored in a data-sources xml > file like this: > > data-source-class="org.postgresql.ds.PGPoolingDataSource" > jndi-name="jdbc/PGPooling" > user="postgres" password="password" > url="jdbc:postgresql://localhost:5432/PGSQL1"/> > > ... > > The program code does a jdni lookup for the DataSource. That means that > you don't have to hard-code connection details into the source. But, as > things stand, I have to hard-code the database name. Sorry, I guess I wasn't clear. Your container will be constructing a PGPoolingDataSource object, then calling various JavaBean-property-style methods on it to initialize it. These are methods such as setUser(), setPassword(), and setDatabaseName(). When PGPoolingDataSource is asked for a connection, it constructs a driver URL from the various properties it is configured with and then requests a connection with that URL. The set of properties provided by a particular DataSource implementation can vary -- the container is meant to use introspection to find and invoke the property accessors. PGPoolingDataSource does not have a "url" property, it does not provide setURL() or similar. So I don't know what the container is doing with that "url" parameter, but it's not being set on the DataSource for sure. As the URL you specify never makes it to the DataSource, it's not suprising that the information you specify there is not used. You need to persuade your container to call the JavaBean accessor setDatabaseName() on the DataSource before use. Perhaps you could try adding an attribute called databaseName to your configuration element above? This is why manually calling setDatabaseName fixes the "problem" -- but it's the container's job to call it, as you say. So complain to your container's vendor.. the PG datasource is working as designed, AFAIK. -O