What causes the PgSqlConnection.ConnectionLost event to fire?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
branrigg
Posts: 6
Joined: Mon 31 Aug 2015 23:07

What causes the PgSqlConnection.ConnectionLost event to fire?

Post by branrigg » Mon 31 Aug 2015 23:12

Specifically, I'm wondering if a failure/exception when calling PgSqlConnection.Open() will cause the PgSqlConnection.ConnectionLost event to fire. And if it does, what would be the ConnectionLostCause? (Like ConnectionLostCause.Connect or .Execute, etc).

Thanks very much for your time and help!

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: What causes the PgSqlConnection.ConnectionLost event to fire?

Post by Pinturiccio » Tue 01 Sep 2015 12:27

The ConnectionLost event fires when the connection is lost. The connection must be open for this, and that's why this event never fires when opening the connection.

branrigg
Posts: 6
Joined: Mon 31 Aug 2015 23:07

Re: What causes the PgSqlConnection.ConnectionLost event to fire?

Post by branrigg » Tue 01 Sep 2015 21:29

Ok, thanks.

What events do fire when PgSqlConnection.Open() fails (like with a "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host." message)?

Pinturiccio
Devart Team
Posts: 2192
Joined: Wed 02 Nov 2011 09:44

Re: What causes the PgSqlConnection.ConnectionLost event to fire?

Post by Pinturiccio » Wed 02 Sep 2015 15:37

The Error event fires when an error occurs while opening a connection. For more information, please refer to https://www.devart.com/dotconnect/postg ... or_EV.html

Post Reply