Solved

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

Posted on 2004-03-23
11
281 Views
Last Modified: 2010-05-18

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
0
Comment
Question by:jemty
  • 4
  • 2
  • 2
  • +1
11 Comments
 
LVL 1

Accepted Solution

by:
GordanM earned 250 total points
Comment Utility
You can turn the connection pooling off.  Take a look at this:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql2k_connpooling.asp
0
 
LVL 1

Expert Comment

by:GordanM
Comment Utility
0
 
LVL 6

Expert Comment

by:gtvingo14
Comment Utility
also make sure that you close your resultsets and statements
0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
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:
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:jemty
Comment Utility
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


0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
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
0
 

Author Comment

by:jemty
Comment Utility
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
0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
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!
0
 
LVL 2

Expert Comment

by:NetoMan
Comment Utility
ok.
thanks all.
Sorry I was on a trip

0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now