Thread: SQLConnect failure

SQLConnect failure

From
greg@bryantrecording.com
Date:
We have code that has been using MSDE/SQL Server successfully for years,
and are adding Postgres support.  Doing a SQLConnect to connect to a
local Postgres server works fine, but if we try to connect to a remote
system, the SQLConnect fails, and we get an error code that seems to
indicate "The value specified for the argument UserName or the value
specified for the argument Authentication violated restrictions defined
by the data source.".

We can connect via pgadmin to the remote system, so we believe all the
little .conf files should be correct, but can't get in
programmatically.  Any pointers on where to look?

Thanks,
Greg


Re: SQLConnect failure

From
Erik Jones
Date:

On Apr 2, 2007, at 4:36 PM, greg@bryantrecording.com wrote:

We have code that has been using MSDE/SQL Server successfully for years,
and are adding Postgres support.  Doing a SQLConnect to connect to a
local Postgres server works fine, but if we try to connect to a remote
system, the SQLConnect fails, and we get an error code that seems to
indicate "The value specified for the argument UserName or the value
specified for the argument Authentication violated restrictions defined
by the data source.".  

We can connect via pgadmin to the remote system, so we believe all the
little .conf files should be correct, but can't get in
programmatically.  Any pointers on where to look?  

Are the host your running your SQLConnect and the host pgadmin the same?  If not, you probably need to edit your pg_hba.conf file (in your data directory) to allow connections from the host your code is running on.

erik jones <erik@myemma.com>
software developer
615-296-0838
emma(r)



Re: SQLConnect failure

From
Bill Moran
Date:
In response to greg@bryantrecording.com:

> We have code that has been using MSDE/SQL Server successfully for years,
> and are adding Postgres support.  Doing a SQLConnect to connect to a
> local Postgres server works fine, but if we try to connect to a remote
> system, the SQLConnect fails, and we get an error code that seems to
> indicate "The value specified for the argument UserName or the value
> specified for the argument Authentication violated restrictions defined
> by the data source.".
>
> We can connect via pgadmin to the remote system, so we believe all the
> little .conf files should be correct, but can't get in
> programmatically.  Any pointers on where to look?

The logs on the PostgreSQL server would be a good place to start.

This sounds suspiciously like a pg_hba.conf misconfig.  You might want
to verify its correctness.

--
Bill Moran
http://www.potentialtech.com

Re: SQLConnect failure

From
greg@bryantrecording.com
Date:

> -------- Original Message --------
> Subject: Re: [GENERAL] SQLConnect failure
> From: Bill Moran <wmoran@potentialtech.com>
> Date: Mon, April 02, 2007 2:54 pm
> To: greg@bryantrecording.com
> Cc: pgsql-general@postgresql.org
>
> In response to greg@bryantrecording.com:
>
> > We have code that has been using MSDE/SQL Server successfully for
> years,
> > and are adding Postgres support.  Doing a SQLConnect to connect to a
> > local Postgres server works fine, but if we try to connect to a remote
> > system, the SQLConnect fails, and we get an error code that seems to
> > indicate "The value specified for the argument UserName or the value
> > specified for the argument Authentication violated restrictions defined
> > by the data source.".
> >
> > We can connect via pgadmin to the remote system, so we believe all the
> > little .conf files should be correct, but can't get in
> > programmatically.  Any pointers on where to look?
>
> The logs on the PostgreSQL server would be a good place to start.
>
> This sounds suspiciously like a pg_hba.conf misconfig.  You might want
> to verify its correctness.
>

Thanks guys.  I can connect to the remote server via pgadmin on a
different machine, so I'm pretty sure that the .conf files are correct
(that took awhile, but there are very good diagnostic messages when
they are wrong).  When I set the hba, the encryption is set to MD5 -
does that need to be set somewhere on the client side?


Re: SQLConnect failure

From
Andrei Kovalevski
Date:
greg@bryantrecording.com wrote:
>
>> -------- Original Message --------
>> Subject: Re: [GENERAL] SQLConnect failure
>> From: Bill Moran <wmoran@potentialtech.com>
>> Date: Mon, April 02, 2007 2:54 pm
>> To: greg@bryantrecording.com
>> Cc: pgsql-general@postgresql.org
>>
>> In response to greg@bryantrecording.com:
>>
>>
>>> We have code that has been using MSDE/SQL Server successfully for
>>>
>> years,
>>
>>> and are adding Postgres support.  Doing a SQLConnect to connect to a
>>> local Postgres server works fine, but if we try to connect to a remote
>>> system, the SQLConnect fails, and we get an error code that seems to
>>> indicate "The value specified for the argument UserName or the value
>>> specified for the argument Authentication violated restrictions defined
>>> by the data source.".
>>>
>>> We can connect via pgadmin to the remote system, so we believe all the
>>> little .conf files should be correct, but can't get in
>>> programmatically.  Any pointers on where to look?
>>>
>> The logs on the PostgreSQL server would be a good place to start.
>>
>> This sounds suspiciously like a pg_hba.conf misconfig.  You might want
>> to verify its correctness.
>>
>>
>
> Thanks guys.  I can connect to the remote server via pgadmin on a
> different machine, so I'm pretty sure that the .conf files are correct
> (that took awhile, but there are very good diagnostic messages when
> they are wrong).  When I set the hba, the encryption is set to MD5 -
> does that need to be set somewhere on the client side?
>

    What version of the PostgreSQL ODBC driver you are using?

> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
>