ada
ada

Reputation: 321

Connection must be valid and open in Ddtek.Oracle.OracleConnection

Need some help from Oracle app developers out there:

I have an C#.NET 4.0 application which updates and inserts into a table using DDTek.Oracle library. My app runs everyday for about 12 hours and this exception came exactly twice and 15 days apart and never before. On these days, it was running fine for hours(it did both inserts and updates during this period). And then this exception comes. I have read that this exception could be from a bad connection string, but as I said before, the app has been running fine for a while. Could this be a db or network issue or could it be something else?

System.InvalidOperationException: Connection must be valid and open
at DDTek.Oracle.OracleConnection.get_Session()
at DDTek.Oracle.OracleConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at DDTek.Oracle.OracleConnection.BeginTransaction()

FYI(if this could be the cause), I have two connections on two threads. Each thread updates a different table. PS: If anyone know a good documentation for DDTek. Please reply with a link.

Upvotes: 0

Views: 856

Answers (1)

Yahia
Yahia

Reputation: 70379

From what you describe I can only speculate - there are several possibilities:

  • most providers offer built-in pooling, sometimes a connection in the pool becomes invalid and you get some strange behaviour
  • sometimes the network settings/firewalls/IDS... limit how long a TCP connection can stay open
  • sometimes a subtle bug (accessing same connection from 2 different threads) leads to strange problems
  • sometimes the DB server (or a DB firewall) limits how long a session can stay connected
  • sometimes memory problems cause such behaviour, almost every Oracle provider uses OCI under the hood which requires using unmanaged heap etc.
    I had one provider leaking unmanaged memory (diagnosed via a memory profiler and fixec by the vendor rather fast)
  • sometimes when connected to a RAC one listener/node goes down and/or some failover happens leaving current connections invalid

As for a link to comprehensive documentation of DDTek.Oracle see here and here.

Upvotes: 1

Related Questions