chris
chris

Reputation: 37490

asp.net connection pooling: automatically testing & validating connections?

I know with some connection pools, you can specify a test query the pool manager can use to validate a connection.

Is there anything similar to that for asp.net? I'm having a problem where there's a firewall between the web app and the database, and it's closing idle connections - the result is that the user gets an "ORA-03135: connection lost contact" error. Reloading the page is fine, but I'd like to remove that error completely.

Upvotes: 2

Views: 1679

Answers (2)

Rimi
Rimi

Reputation: 81

As described in Oracle documentation, there is Validate Connection=true setting in connection string.

"The Validate Connection attribute validates connections coming out of the pool. This attribute should be used only when absolutely necessary, because it causes a round-trip to the database to validate each connection immediately before it is provided to the application. If invalid connections are uncommon, developers can create their own event handler to retrieve and validate a new connection, rather than using the Validate Connection attribute. This generally provides better performance."

Upvotes: 1

Josh
Josh

Reputation: 8487

If the latest Oracle driver hasn't fixed the problem, the ugly solution is to build a Windows Service that pings the database every X seconds. I'm not sure what X would be, I'm guessing every 30 seconds.

Upvotes: 0

Related Questions