Little and Mickle

All things are difficult before they are easy.

导航

about Ora-03114 disable asp.net connection pool(pooling)

I have met the ora-03114 error ("not connected to oracle")when connection Oracle 9i through asp.net by OracleClient drive. And tried to use OLEDB to connect to oracle, the error still occured.

It seems the ora-03114 error occured randomly, more exactly, it would occur several hours after the web application run, or occur in every morning. after the error appearance, no one could logon web application(logon process would be validated in database), each time it shows exception of ora-03114.

What confused us is when the connection error happen, and we rename the Web.config to a new name, and rename it back; or just modify the connection string, and modify it back, things would be ok. I think when web.config is modified, IIS would recompile(maybe restart is more exact) web application and repick connection string. Later, through searching engine's help, of course done by goole, I know IIS makes a connection pool for each different connection string, and do not release the connection even when network is down or oracle is restarted. thus when server execute a query, it failed. And we searched and know it is a bug of Dotnet pooling.

I tried several days, and found a way to solve the problem. when we use oledb to connecting to oracle, and immediatly dispose connection after each query(query by instance connection), it would works fine. However, we use OracleClient before, and use each query was done by a single static instance connection. It would cost a great effort to change our source code.

At last we contact Microsoft, and got a solution to disable connection pool,  just add "Pooling=False" in the connection string for OracleClient.(SqlClient and OracleClient are the same), or add "OLE DB Services=-4;" for OLEDB.

After disable connection pool, the second time we log on the system, it could be connecting all the time, and do not throw an exception or connected to database. We found our static connection wasn't closed, the pooling is false, thus it always tried to connect to oracle and failed. We close the connection each time a session start in the Session_Start() of Global.asax. It solved all problems.

posted on 2005-09-21 11:04  davidullua  阅读(1913)  评论(1)    收藏  举报