0

I searched a lot trying to find why am I getting this error but no help, can you please advise.

I am getting the following error when executing a linq query

    var test = (Linq query).ToList<Testdata>();

System.Data.EntityException: An error occurred while closing the provider connection. See the inner exception for details. ---> Devart.Data.Oracle.OracleException: OCI invalid handle.

at Devart.Data.Oracle.a1.c(Int32 A_0) at Devart.Data.Oracle.aq.d()

at Devart.Data.Oracle.OracleInternalConnection.a(Boolean A_0)

at Devart.Common.DbConnectionInternal.CloseInternalConnection()

at Devart.Data.Oracle.OracleInternalConnection.CloseInternalConnection()

at Devart.Common.DbConnectionInternal.Close()

at Devart.Data.Oracle.OracleInternalConnection.Close()

at Devart.Common.DbConnectionBase.Close()

at Devart.Data.Oracle.OracleConnection.Close()

at System.Data.EntityClient.EntityConnection.StoreCloseHelper() --- End of inner exception stack trace ---

at System.Data.EntityClient.EntityConnection.StoreCloseHelper()

at System.Data.EntityClient.EntityConnection.CloseHelper()

at System.Data.EntityClient.EntityConnection.Close()

at System.Data.Objects.ObjectContext.ReleaseConnection()

at System.Data.Common.Internal.Materialization.Shaper`1.Finally()

at ystem.Data.Common.Internal.Materialization.Shaper`1.ObjectQueryNestedEnumerator.Dispose()

at System.Collections.Generic.List1..ctor(IEnumerable1 collection)

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Mocas
  • 1,403
  • 13
  • 20
  • What is the value set to query? – Chetan Jun 06 '17 at 11:13
  • Sorry I don't understand your question – Mocas Jun 06 '17 at 11:14
  • Can you share some more code? What is (Linq query)? How are you getting the it? Are you getting exception on this line of code? How do you initialize the dbContext? – Chetan Jun 06 '17 at 11:16
  • Unfortunately, due to work policy, I can't share the code. Do you think the problem is due to the query itself then? – Mocas Jun 06 '17 at 11:18
  • One reason I can think of is the dbContext is already disposed when you create query. And ToList is trying to use it. – Chetan Jun 06 '17 at 11:27
  • Thank you, much appreciated. I know that at the time of this call the pool has reached max size, do you think this could be related? – Mocas Jun 06 '17 at 11:53
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/145965/discussion-between-user2410199-and-chetan-ranpariya). – Mocas Jun 06 '17 at 11:55
  • It may not be connection pool but dbContext is being disposed earlier. How that can happen depends on how and when it is initialized and where it is being disposed. If you using "using" block to wrap the dbContext and creating query and doing ToList out if using block then this issue might happen. Is it the same line which shared causes the exception? – Chetan Jun 06 '17 at 12:37

2 Answers2

1

Please send us a small test project and DDL/DML script for reproducing the issue in our environment. Also specify the versions of your Oracle Server and Oracle Client.

Devart
  • 119,203
  • 23
  • 166
  • 186
  • Thank you for your answer. I am currently looking into the possibility of issues with connectivity to the Oracle database(11g), and excluding the possibility of a Devart component issue. – Mocas Jun 08 '17 at 15:29
0

Issue was due to pool reaching max capacity

Mocas
  • 1,403
  • 13
  • 20