Mikayil Abdullayev
Mikayil Abdullayev

Reputation: 12376

Getting Connection lost contact even though a new connection is created

I'm writing an ASP.NET web application. The database is Oracle. I've recently noticed that if I leave the application open for a while without doing anything and then try to access the database I get "ORA-03135: connection lost contact" error. One reason I can think of first is the connection timeout but I create a fresh new connection, open it, do what I need to do and "finally" close it every time I access the database. What's more interesting is after I get this error, I don't have any problems any more with connecting to the database. Do you have any ideas as to what the problem might be?

Upvotes: 2

Views: 755

Answers (1)

mattneri
mattneri

Reputation: 103

Are you using a connection pool? In this case you can get this behaviour because the Oracle Connection Pool returns a "disconnected" connection. Try adding Validate Connection=True; to your connection string.

Upvotes: 2

Related Questions