Обсуждение: How to get correct error message before logging to database

Поиск
Список
Период
Сортировка

How to get correct error message before logging to database

От
"Andrus"
Дата:
Tried

x84 driver 09.05.0300 in Windows 10 x64 with Visual FoxPro
Server is Postgres 9.5 in same maschine.

If there is no host name, user name or password is wrong, this driver
returns always same error  message

Connectivity error: Unable to retrieve specific error information.  Driver
is probably out of resources

Earlier versions of drivers returned correct error message.

After logging in correct error messages are returned.

How to fix ?

Andrus.



Re: How to get correct error message before logging to database

От
Adrian Klaver
Дата:
On 07/04/2016 12:42 PM, Andrus wrote:
> Tried
>
> x84 driver 09.05.0300 in Windows 10 x64 with Visual FoxPro
> Server is Postgres 9.5 in same maschine.
>
> If there is no host name, user name or password is wrong, this driver
> returns always same error  message
>
> Connectivity error: Unable to retrieve specific error information.
> Driver is probably out of resources

What application is actually throwing the error?

Is the above a direct quote or a translation?

I ask because I do not find it in the 09.05.0300 source.

>
> Earlier versions of drivers returned correct error message.

Which version(s) exactly.

What message did they return?

>
> After logging in correct error messages are returned.
>
> How to fix ?
>
> Andrus.
>
>


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: How to get correct error message before logging to database

От
"Andrus"
Дата:
Hi!

> What application is actually throwing the error?

Visual FoxPro.
It uses message returned from odbc using AERROR() function.

>Is the above a direct quote or a translation?

It is direct quote. Copied from windows messagebox using Ctrl+C

> I ask because I do not find it in the 09.05.0300 source.

Maybe Windows ODBC or VFP cannot retrieve error message and thus return
this.

> Earlier versions of drivers returned correct error message.
>Which version(s) exactly.

09.00.0101 and previous versions.

>What message did they return?

They returned messages like:

FATAL:  password authentication failed for user "xxx"

fe_sendauth: no password supplied

could not translate host name "xxxxx" to address: Unknown server error


After logged in normal messages appear.

Andrus.



Re: How to get correct error message before logging to database

От
Adrian Klaver
Дата:
On 07/05/2016 07:50 AM, Andrus wrote:
> Hi!
>
>> What application is actually throwing the error?
>
> Visual FoxPro.
> It uses message returned from odbc using AERROR() function.
>
>> Is the above a direct quote or a translation?
>
> It is direct quote. Copied from windows messagebox using Ctrl+C
>
>> I ask because I do not find it in the 09.05.0300 source.
>
> Maybe Windows ODBC or VFP cannot retrieve error message and thus return
> this.

Likely given that VFP is past end-of-life.

>
>> Earlier versions of drivers returned correct error message.
>> Which version(s) exactly.
>
> 09.00.0101 and previous versions.

That is many versions past. The only thing I can think of at the moment is:

https://odbc.postgresql.org/docs/release.html

psqlODBC 09.05.0100 Release
Changes:

     Use libpq for all communication with the server
     Previously, libpq was only used for authentication. Using it for
all communication lets us remove a lot of duplicated code. libpq is now
required for building or using libpq.

You might try the version immediately preceding the above:

psqlODBC 09.03.0400

to see if you get the old behavior or new.


>
>> What message did they return?
>
> They returned messages like:
>
> FATAL:  password authentication failed for user "xxx"
>
> fe_sendauth: no password supplied
>
> could not translate host name "xxxxx" to address: Unknown server error
>
>
> After logged in normal messages appear.
>
> Andrus.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: How to get correct error message before logging to database

От
"Andrus"
Дата:
Hi!

>That is many versions past. The only thing I can think of at the moment is:
>https://odbc.postgresql.org/docs/release.html
>psqlODBC 09.05.0100 Release
>Changes:
>     Use libpq for all communication with the server
>     Previously, libpq was only used for authentication. Using it for all
> communication lets us remove a lot of duplicated code. libpq is now
> required for building or using libpq.
>You might try the version immediately preceding the above:
>psqlODBC 09.03.0400
>to see if you get the old behavior or new.

09.03.0400 returns proper error message on login with invalid server
address:

could not translate host name "xxx" to address: Unknown host

AERROR() returns also sql error code.

How to get proper error message in 09.05.0300 ?
Maybe libpq does not return error messages before connection is established.
I can post odbc log if this helps.

Andrus.



Re: How to get correct error message before logging to database

От
Adrian Klaver
Дата:
On 07/05/2016 01:42 PM, Andrus wrote:
> Hi!
>
>> That is many versions past. The only thing I can think of at the
>> moment is:
>> https://odbc.postgresql.org/docs/release.html
>> psqlODBC 09.05.0100 Release
>> Changes:
>>     Use libpq for all communication with the server
>>     Previously, libpq was only used for authentication. Using it for
>> all communication lets us remove a lot of duplicated code. libpq is
>> now required for building or using libpq.
>> You might try the version immediately preceding the above:
>> psqlODBC 09.03.0400
>> to see if you get the old behavior or new.
>
> 09.03.0400 returns proper error message on login with invalid server
> address:
>
> could not translate host name "xxx" to address: Unknown host
>
> AERROR() returns also sql error code.
>
> How to get proper error message in 09.05.0300 ?
> Maybe libpq does not return error messages before connection is
> established.

Well it is using libpq for authentication on 09.03.0400, which is the
part that is going to throw the errors.

Also psql, which uses libpq does this:

aklaver@panda:~> psql -d test -U aklaver -W -h host
Password for user aklaver:
psql: could not translate host name "host" to address: Name or service
not known


aklaver@panda:~> psql -d test -U aklaver -W -h localhost
Password for user aklaver:
psql: FATAL:  password authentication failed for user "aklaver"
FATAL:  password authentication failed for user "aklaver"


So I am thinking this not a libpq issue, but a change in error reporting
when the code was reorganized in 09.05.0100. I do not know the internals
well enough to say anything more. Hopefully someone that does can fill
in the blanks.
`

> I can post odbc log if this helps.
>
> Andrus.


--
Adrian Klaver
adrian.klaver@aklaver.com


Re: How to get correct error message before logging to database

От
"Andrus"
Дата:
Hi!

>So I am thinking this not a libpq issue, but a change in error reporting
>when the code was reorganized in 09.05.0100. I do not know the internals
>well enough to say anything more. Hopefully someone that does can fill in
>the blanks.

Thank for information.

I programmed in C 25 years ago. I'm using Visual Studio 2015 and C#.
Should I start to research driver source code and odbc log to find out which
method call fails ?
Or is there better way ?

I posted it also in
http://stackoverflow.com/questions/38212586/how-to-get-proper-error-message-before-logging-in-from-psqlodbc-driver

Andrus.



Re: How to get correct error message before logging to database

От
"Inoue, Hiroshi"
Дата:
Hi Andrus,

On 2016/07/06 17:53, Andrus wrote:
Hi!

So I am thinking this not a libpq issue, but a change in error reporting
when the code was reorganized in 09.05.0100. I do not know the internals
well enough to say anything more. Hopefully someone that does can fill in
the blanks.

Thank for information.

I programmed in C 25 years ago. I'm using Visual Studio 2015 and C#.
Should I start to research driver source code and odbc log to find out which
method call fails ?
Or is there better way ?

Could you please try 09.05.0301 at
  
http://www.ne.jp/asahi/inocchichichi/entrance/psqlodbc/index.html
?


regards,
Hiroshi Inoue

Re: How to get correct error message before logging to database

От
"Andrus"
Дата:
Hi!
 

 
This driver returns proper error messages.
Thank you very much.
 
Andrus.