Handling connection errors

Handling connection errors

Postby fa » Thu 28 Apr 2011 15:57

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?
fa
 
Posts: 3
Joined: Thu 28 Apr 2011 15:05

Postby AlexP » Fri 29 Apr 2011 11:10

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.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Postby fa » Sun 01 May 2011 02:01

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?
fa
 
Posts: 3
Joined: Thu 28 Apr 2011 15:05

Postby AlexP » Wed 04 May 2011 10:01

Hello,

Unfortunately, you can't get such message, this is connected with the specifics of dbExpress driver.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Re: Handling connection errors

Postby mdehaij » Wed 15 Jan 2014 15:01

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
mdehaij
 
Posts: 8
Joined: Mon 13 Jan 2014 13:08

Re: Handling connection errors

Postby AlexP » Thu 16 Jan 2014 07:18

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
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35

Re: Handling connection errors

Postby mdehaij » Mon 20 Jan 2014 09:29

Thanks, can't wait for the next version :D
mdehaij
 
Posts: 8
Joined: Mon 13 Jan 2014 13:08

Re: Handling connection errors

Postby AlexP » Mon 20 Jan 2014 10:09

Hello,

We plan to release a new version in the end of this - beginning of the next month.
AlexP
Devart Team
 
Posts: 5528
Joined: Tue 10 Aug 2010 11:35


Return to dbExpress driver for PostgreSQL