Page 1 of 1

Handling connection errors

Posted: Thu 28 Apr 2011 15:57
by fa
Hi,

I'm sorry if my English is not good,

I'm using Delphi XE, PostgreSQL 9.0 and driver version 1.40.

When I try to connect to a database with component TSQLConnection with wrong settings, for example, connect to a database that does not exist, I get the following error message: "Cannot connect to database. Socket error on read. WSAGetLastError 10054 ($2746)". The error code generated DBXError is different from all the error constants of dbexpress.

When I try to connect to a database and the connection fails due to network, I get the following error message: "Cannot connect to database. Socket error on read. WSAGetLastError...". The error code generated DBXError is different from all the error constants of dbexpress.

Why the error code generated by a connection failure (TDBXError) of the driver is different from the constant "ConnectionFailed"?
Why the driver error messages are as "Can not connect to database. Socket error on read. WSAGetLastError ..." instead of "Database does not exist" for example?

Posted: Fri 29 Apr 2011 11:10
by AlexP
Hello,

As our dbExpress driver for PostgreSQL doesn't use PostgreSQL Client, we get error messages from WinApi, and show them as is.
We will investigate the possibility of giving more descriptive error messages.

Posted: Sun 01 May 2011 02:01
by fa
When i run the application on debug mode(delphi), i saw that before the exception of class TDBXError was throwed, an exception of class EPgError was raised, with the correct message error. EPgError is replaced by TDBXError later.
Could throw the TDBXError excpetion with the message of the replaced exception EPgError and with the error code equal to ConnectionFailed constant?

Posted: Wed 04 May 2011 10:01
by AlexP
Hello,

Unfortunately, you can't get such message, this is connected with the specifics of dbExpress driver.

Re: Handling connection errors

Posted: Wed 15 Jan 2014 15:01
by mdehaij
Is there any progress on getting more descriptive error messages?
The standard ones are not much helpful :(

We also get the "WSAGetLastError return 10054($2746)" upon trying to connect to a database which does not exist. Is this error message only reserved for this particular situation? We could translate it for the user if that is the case.

Thanks in advance,
Martin

Re: Handling connection errors

Posted: Thu 16 Jan 2014 07:18
by AlexP
Hello,

We have already modified the behavior. From now, when an error occurs, a correct message with error description will be displayed. This fix will be included to the next version

Re: Handling connection errors

Posted: Mon 20 Jan 2014 09:29
by mdehaij
Thanks, can't wait for the next version :D

Re: Handling connection errors

Posted: Mon 20 Jan 2014 10:09
by AlexP
Hello,

We plan to release a new version in the end of this - beginning of the next month.