Wrong implementation of IDbConnection.State

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
iouri.bespalov
Posts: 3
Joined: Fri 08 Oct 2010 09:39

Wrong implementation of IDbConnection.State

Post by iouri.bespalov » Thu 18 Aug 2011 12:17

Tested with 3 versions including the latest one.

example:

public override bool IsOpen()
{
bool bPing = false;
try {
bPing = ( (OracleConnection)this.conn ).Ping();
}
catch {
bPing = false;
}
return bPing;
// return ( this.conn.State == ConnectionState.Open );
}

I expect that after a round trip to the database with exception such as ORA-12537 connection closed the state change to ConnectionState.Closed or ConnectionState.Brocken. As for example in odp or ado implemented.

In Your solution it plays no role: is this adirect or indirect connection, the state is Open.

Please fix this

Addition:

Trace of Your Ping():
-----------------------------------------------
Timestamp: 18.08.2011 14:03:10
begin null; end;
Elapsed time: 0.001
--------------------------------------------------------------------------------
Timestamp: 18.08.2011 14:03:11
begin null; end;
Elapsed time: 0.001
---------------------------------------------------

So let's calculate
0.001 seconds for each round trip.
if we need to send Ping() before, we say, 1.000.000 calls to the database
we get 1.000.000 x 0.001 = 1000 sec.
1000 seconds = 16,(6) minutes of time that we lose.

than we say that needed select, update,insert or delete use 0.006 sec
so
1.000.000 x 0.006 = 6000 sec = 100 minutes

so we need additional 16,(6) % of time to execute.

It's NO GO

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 18 Aug 2011 13:16

We have reproduced the behaviour when the ConnectionState.Open is not changed to Closed or Broken when OracleConnection.Ping() returns false. We will investigate the issue and notify you about the results as soon as possible. And we have asked you by e-mail for an additional information about the situation when OracleConnection.Ping() raises an exception.

iouri.bespalov
Posts: 3
Joined: Fri 08 Oct 2010 09:39

Post by iouri.bespalov » Fri 19 Aug 2011 06:27

The change of ConnectionState should also change on every Execution with network Exception, not only on using of Ping().

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 19 Aug 2011 10:16

Thank you for your suggestion. We will investigate the possibility of implementing this behaviour.

Post Reply