Wrong implementation of IDbConnection.State
Posted: 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
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