Link to home
Start Free TrialLog in
Avatar of jemty
jemty

asked on

ADO .Net : After closing my oracle connection, it remains open on the oracle server. How can I close it ?


Hi,

I'm working with ASP .Net and WebServices.
In my webservice, I have an OracleConnection object.

I open that connection in the beginning of a lot of functions, and close it a the end of each function.
I thoses functions, I generaly made some updates, inserts, on select of single line results.
So I never use DataAdapters nor dataSet.

But, even if I close my connection at the end of each function, the connection remains open on the oracle server.

I guess this is due to the connection pooling.

But I wan't to definitly close my connection.
(because I sometimes reach the max connection on the oracle server)

How can I do that ???

Thanks to all of you.

Jemty
ASKER CERTIFIED SOLUTION
Avatar of GordanM
GordanM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also make sure that you close your resultsets and statements
jemty:

can you resolve your problem ? I got exactly the same situation with asp. please, if you got a solution share it.

I follow the links to msdn and read the explanation of pooling. I did changed the to odbc settings to <don't pool> but still got teh same result. the connection is not getting closed.

thanks in advance

NetoMan:
Avatar of jemty

ASKER

Hi Guys,

In 2 words : SOLUTION FOUND

There is an article treating the problem of connection pooling for oracle :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconconnectionpoolingfornetdataproviderfororacle.asp

To give you just a little resume of this article, the solution consists of adding some parameters in the connection string.
The most powerfull of all those parameters is the following :
";pooling=false"
As simple as this ;-)
But now I have to test the persformance. Hoping I won't lose too much by disabeling pooling.
(If I loose to much, there is also a parameter to limit the max number of pooled connections).

NetoMan,
I didn't made any tests on ODBC, but perhaps is there also some parameters, like for oracle, to add to the connection string.

Thanks to all of you.

Jemty


Jemty:

thanks, i'm following your comment but I get this error :

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed

I'm using the conecction string like this:

cursor.open SQL, "DRIVER={Microsoft ODBC for Oracle};UID=fo;SERVER=solida;;User Id=fo;PASSWORD=fo
;pooling=false;"

or this, using a DSN with Oracle 7.3 odbc instead of microsoft odbc for oracle driver:

cursor.open SQL, "DSN=solidafo;UID=fo;SERVER=solida;PASSWORD=afopens078;pooling=false;"

I suppose its the ODBC driver ? what version of ODBC are you using ?

thanks in advance
Avatar of jemty

ASKER

NetoMan,

I neither use the ODBC driver from ORACLE nor from Microsoft.

In fact I'm using the Oracle Client ("System.Data.OracleClient").
That means that you have to add "System.Data.OracleClient" as reference in your project.

But (If I remember well), you have to install Oracle Client 9.X on your computer.
(So that it's compatible with .Net)
And, I don't know why but it still doesn't work before you install Oracle Data Access (ODA.NET) on your computer (downloadable on the oracle web site).
(I remember having read some articles on the net about that, but sorry, I don't remember where)

Once you'll have all that, you'll be able to use the native access for oracle, and you'll be able to add the "pooling=false" to your connection string.

Hoping I'm helping you

Jemty
ok, thanks.

I think that the end of my road is still far. I'm using oracle 8i so I have to try some of your comments on my oracle version.

thanks a lot!
ok.
thanks all.
Sorry I was on a trip