realbasic-nug
[Top] [All Lists]

Re: PostgreSQLDatabase Connections

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: PostgreSQLDatabase Connections
From: Robert Lawrence <robl at no-no-badpuppy dot com>
Date: Wed, 30 Apr 2008 12:06:48 -0500
Authentication-results: mx.google.com; spf=pass (google.com: domain of realbasic-nug-bounces at lists dot realsoftware dot com designates 66.116.103.65 as permitted sender) smtp dot mail=realbasic-nug-bounces at lists dot realsoftware dot com
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <8259D3C7-7012-44FF-8D71-FC9FE80003D9 at no-no-badpuppy dot com> <082046DE-73EF-4340-8A3F-361B9B037AA9 at great-white-software dot com> <FE9621B0-4996-43A4-A8DB-ED8B3A6DC0C8 at no-no-badpuppy dot com> <AD99CBA6-F434-4283-ACAC-2BE547C39AE5 at no-no-badpuppy dot com> <96628705-DD4B-4764-BF63-C787625EBB72 at great-white-software dot com> <E0FF2699-A915-4F51-BABE-F3A6143F9177 at no-no-badpuppy dot com> <70DF7608-07FA-481E-91FA-6C30DBA48604 at great-white-software dot com>
As this is a test box, my pg_hba is as follows:

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
local   all         all                               trust
# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
# IPv6 local connections:
host    all         all         ::1/128               trust


Basically allows anything from my local development computer but no  
outside connections.



On Apr 30, 2008, at 11:54 AM, Norman Palardy wrote:

>
> On 30-Apr-08, at 10:42 AM, Robert Lawrence wrote:
>
>> The password wasn't the "solution" but another part of the puzzle.
>> However, I can work around the issue now using a password AND verifiy
>> that the database it connects to is the one the user requested.  I
>> will consider it a failed connection unless both of those tests pass.
>>
>> There is still strange behavior from RB's PostgreSQLDatabase  
>> class.  I
>> can get the .Connect to return true even if the passwords are wrong  
>> --
>> but it will then report connecting to the "postgres" database.  So
>> apparently I can only rely on .Connect to let me know that the server
>> host and port is correct.  I need to validate the requested database
>> is connected (with select current_database() )  as well to ensure the
>> suer/pass and database names are correct.
>>
>> Basically, I have a hack to work around the problem.
>
> What does your pg_hba.conf file look like ?
> If you have "trust" set it permits a connection rand seems to ignore
> the DB you wanted to connect to (which is what my code was seeing)
>
> With this entry
>        host    all     all     10.0.1.4/32                     trust
>
> I get a connection to the wrong database
>
> With this entry
>        host    all     all     10.0.1.4/32                      
> password
>
> and the correct password in my RB code it connects to the db I
> originally tried to connect to
>
> So there is still something funky
>
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>