Activation of DB Connection not detected

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Rolf
Posts: 6
Joined: Wed 11 Jan 2012 15:46

Activation of DB Connection not detected

Post by Rolf » Thu 12 Jul 2012 09:33

Scenario:
A service is starting and wants to access to the DB. The client running the server has currently no network acces (DB server is on a separate machine). The service tries to reconnect again in certain intervals and is able to reach the DB when netwerk connectivity is available.

Problem:
My service starts and has no network connectivity. A try to access the DB fails -> OK
Network connectivity is available again. A try to access the DB still fails -> Not OK

Here a small code sample to reproduce the problem. I compared it with the behaviour of the access to a SQL Server. The SQL server dataContext is able to connect to the DB when the network connecton is available again, dotConnect for Oracle not.

Code: Select all

           
            try
            {
                using (SQL_Server_Entities context = new SQL_Server_Entities())
                {
                    var test = (from p in context.Object1 select p).ToList();
                    Debug.WriteLine("Succesful check: SQL");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Check failed: SQL");
            }

            try
            {
                using (Oracle_Entities context = new Oracle_Entities())
                {
                    var test = (from p in context.Object2 select p).ToList();
                    Debug.WriteLine("Succesful check: Devart Oracle");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Check failed: Devart Oracle");
            }
When a first access to the DB is successful and then the connection gets lost, devConnect is able to reconnect when the connection is available again.

That does not work when the first DB success is not successful.

Hope you can help me

Best Regards, Rolf

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

Re: Activation of DB Connection not detected

Post by Shalex » Wed 18 Jul 2012 09:53

We have performed the following test:

Code: Select all

            // DISABLE NETWORK before executing the following lines
            try
            {
                using (Oracle_Entities context = new Oracle_Entities())
                {
                    var test = (from p in context.Object2 select p).ToList();
                    Debug.WriteLine("Successful check: Devart Oracle");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Check failed: Devart Oracle");
            }

            // ENABLE NETWORK before executing the following lines
            try
            {
                using (Oracle_Entities context = new Oracle_Entities())
                {
                    var test = (from p in context.Object2 select p).ToList();
                    Debug.WriteLine("Successful check: Devart Oracle");
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Check failed: Devart Oracle");
            }
Output:
Check failed: Devart Oracle
Successful check: Devart Oracle

Please specify:
1) the exact (x.xx.xxx) version of dotConnect for Oracle you are working with;
2) your connection string (roughly, without credentials);
3) the text of the error and the call stack;
4) how should we modify the code to reproduce the issue?

Rolf
Posts: 6
Joined: Wed 11 Jan 2012 15:46

Re: Activation of DB Connection not detected

Post by Rolf » Wed 18 Jul 2012 14:58

This is exactly the test I perform and I get two failures.

Check failed: Devart Oracle
Check failed: Devart Oracle

I unplug my network cable to interrupt the access to the databaase server and plug it again. I wait some seconds and perform some network access checks to make sure that the connection has been reactivated before I continue with the second part of the test.

Make sure that there is no other database access in the test app before performing the test. When some other DB access is executed in the same app before the test, the reactivation of the DB connection is successful.


Here the information you required:

Version : 7.0.17.0

Entity Connectionstring:

<add name="UNITTESTEntitiesConnectionString" connectionString="metadata=res://*/DataModel1.csdl|res://*/DataModel1.ssdl|res://*/DataModel1.msl;provider=Devart.Data.Oracle;provider connection string="User Id=unittest;Password=*****;Server=DE*****;Home=oraclient11g_home1_32bit;Persist Security Info=True""


The error is in both cases the same

Fehler beim zugrunde liegenden Anbieter auf Open.

Inner exception:
Server did not respond within the specified timeout interval

Callstack:

bei System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)
bei System.Data.EntityClient.EntityConnection.Open()
bei System.Data.Objects.ObjectContext.EnsureConnection()
bei System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
bei System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bei ConnectionTestSqlServer.Form1.button1_Click(Object sender, EventArgs e) in E:\Project\Prototyping\ConnectionTestSqlServer\ConnectionTestSqlServer\Form1.cs:Zeile 43.

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

Re: Activation of DB Connection not detected

Post by Shalex » Mon 23 Jul 2012 14:11

We cannot reproduce the issue in our environment.

1.
Rolf wrote:Scenario:
A service is starting and wants to access to the DB. The client running the server has currently no network acces (DB server is on a separate machine). The service tries to reconnect again in certain intervals and is able to reach the DB when netwerk connectivity is available.
Please describe your network structure (wireless/cable, how you connect, etc). If possible, check if the problem occurs in other network.

2.
Rolf wrote:When some other DB access is executed in the same app before the test, the reactivation of the DB connection is successful.
Is "other DB access" (the first one after the reactivation) successful in this case? Does the problem persist only with EF connection?

3. Does the "Validate Connection=true;" connection parameter help?

Post Reply