474,042 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OracleConnectio n

Hi - is it the case that OracleConnectio n does not call close when the
connection is disposed?

For example, I use this sort of construct:

using (OracleConnecti on conn = GetConnection() )
{
using (OracleTransact ion tx = conn.BeginTrans action())
{
using (OracleCommand command = conn.CreateComm and())
etc.

But now a colleague tells me that the connection is not closed when the
using clause ends. Can this be true? Is that not a serious bug in
OracleConnectio n?

Or could it be affected by the "GetConnect ion" method which is a call to a
third-party class which actually gives us a connection - I mean, could
GetConnection somehow affect the subsequent "dispose" behaviour of the
connection?

Thanks,
Peter
Nov 7 '07 #1
6 4517
Peter,

What makes you think that it is not being closed? If you are using
connection pooling, then you might see the connection open still (not to
your code through the OracleConnectio n class, but through a performance
counter, for example). Other than that, the code you wrote will call the
Dispose method on the connection, which will close the connection.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Peter K" <xd****@hotmail .comwrote in message
news:eQ******** ******@TK2MSFTN GP03.phx.gbl...
Hi - is it the case that OracleConnectio n does not call close when the
connection is disposed?

For example, I use this sort of construct:

using (OracleConnecti on conn = GetConnection() )
{
using (OracleTransact ion tx = conn.BeginTrans action())
{
using (OracleCommand command = conn.CreateComm and())
etc.

But now a colleague tells me that the connection is not closed when the
using clause ends. Can this be true? Is that not a serious bug in
OracleConnectio n?

Or could it be affected by the "GetConnect ion" method which is a call to a
third-party class which actually gives us a connection - I mean, could
GetConnection somehow affect the subsequent "dispose" behaviour of the
connection?

Thanks,
Peter

Nov 7 '07 #2
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote
in news:OC******** ******@TK2MSFTN GP03.phx.gbl:
Peter,

What makes you think that it is not being closed? If you are
using
connection pooling, then you might see the connection open still (not
to your code through the OracleConnectio n class, but through a
performance counter, for example). Other than that, the code you
wrote will call the Dispose method on the connection, which will close
the connection.
Hi thanks, these were also my thoughts. I have no evidence that
OracleConnectio n does not behave as expected - a colleague has just told me
I need to explictly close my connections because OracleConnectio n does not
function correctly on a dispose (ie at the end of a using clause).

I have not yet heard back from him about how he has ascertained this.
Nov 7 '07 #3
Peter K wrote:
Hi - is it the case that OracleConnectio n does not call close when
the connection is disposed?

For example, I use this sort of construct:

using (OracleConnecti on conn = GetConnection() )
{
using (OracleTransact ion tx = conn.BeginTrans action())
{
using (OracleCommand command = conn.CreateComm and())
etc.

But now a colleague tells me that the connection is not closed when
the using clause ends. Can this be true? Is that not a serious bug in
OracleConnectio n?

Or could it be affected by the "GetConnect ion" method which is a call
to a third-party class which actually gives us a connection - I mean,
could GetConnection somehow affect the subsequent "dispose" behaviour
of the connection?
ODP.NET or MS Oracle client?

ODP.NET has a lot of tiny little quircks, like calling Dispose on
every element or else you'll have memory leaks etc. Though I don't
think any ADO.NET provider leaves a connection open when dispose is
called, simply because the connection has to be cleaned up to make
dispose do its job :)

Closing a connection will make it go to the pool, which means the
connection physically stays open for some time. Perhaps your collegue
meant that, although with close you can't change that behavior. (nor
should you want to)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Nov 8 '07 #4
"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n lwrote in
news:xn******** *******@news.mi crosoft.com:
ODP.NET or MS Oracle client?

ODP.NET has a lot of tiny little quircks, like calling Dispose on
every element or else you'll have memory leaks etc. Though I don't
think any ADO.NET provider leaves a connection open when dispose is
called, simply because the connection has to be cleaned up to make
dispose do its job :)

Closing a connection will make it go to the pool, which means the
connection physically stays open for some time. Perhaps your collegue
meant that, although with close you can't change that behavior. (nor
should you want to)
Hi there

We are using Oracle.DataAcce ss.Client.Oracl eConnection.

I wasn't really aware of the different connection objects one could use. Do
you have references to the different types?

Thanks,
Peter
Nov 8 '07 #5
Peter K wrote:
"Frans Bouma [C# MVP]" <pe************ ******@xs4all.n lwrote in
news:xn******** *******@news.mi crosoft.com:
ODP.NET or MS Oracle client?

ODP.NET has a lot of tiny little quircks, like calling Dispose
on every element or else you'll have memory leaks etc. Though I
don't think any ADO.NET provider leaves a connection open when
dispose is called, simply because the connection has to be cleaned
up to make dispose do its job :)

Closing a connection will make it go to the pool, which means
the connection physically stays open for some time. Perhaps your
collegue meant that, although with close you can't change that
behavior. (nor should you want to)

Hi there

We are using Oracle.DataAcce ss.Client.Oracl eConnection.

I wasn't really aware of the different connection objects one could
use. Do you have references to the different types?
You're using ODP.NET, which is preferable over Microsoft's own Oracle
ADO.NET client in .NET. ODP.NET is released by Oracle, and has more
features. The only downside is that it's still a wrapper around its own
Java based CLI, so you do have to call Dispose() on OracleParameter
objects for example otherwise you'll get memory leaks

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Nov 9 '07 #6
Frans Bouma [C# MVP] wrote:
You're using ODP.NET, which is preferable over Microsoft's own Oracle
ADO.NET client in .NET. ODP.NET is released by Oracle, and has more
features. The only downside is that it's still a wrapper around its own
Java based CLI, so you do have to call Dispose() on OracleParameter
objects for example otherwise you'll get memory leaks
Java based CLI ??

Do you mean native OCI ?

Arne
Nov 19 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
455
by: Kevin Vogt | last post by:
When initially loaded, my web application (below) takes ~120000 milliseconds to open its connection. But repeated executions take 0 milliseconds each. But when I wait for approx. 5 minutes and try again, it takes another 120000 milliseconds for Open(). This behavior gets really irritating with the real web application that I'm working on. But the thing I don't understand is, when I make a console app that does the same sort of thing, the...
6
1915
by: Raphaël ARBUZ | last post by:
Hi everybody I have tried to create a Windows Application with an Oracle Connection to a base, but each time the program comes to my line : Connection1.Open(); it generates an exception.in 'system.data.oracleclient.dll' with for only information : "system error" The fact is when I do exactly the same in an asp.net webform, it works and doesn't come to any exception !
0
5797
by: ʹÃûÑï | last post by:
ORA-03114: not connected to ORACLE && MS's Bug?? DataBase:Oracle 817 using OracleClient,net framework 1.1 I'm using ADO.Net in C# with Oracle 817. and following is my public data access class. using System.Data.OracleClient;
1
1090
by: ÍõÑå¾ý | last post by:
Is there a way to connect the oracle server without a oracle client software?
2
1144
by: honeygracee | last post by:
hi i am doing a program and i need to connect 5 projects in 1 solution but right now i am only doing the first project to be connected to the oracle connnection. can you help me on how can i view the first name, middle name and last time on my textbox if i search the employee number ? below is my code sample.. please help me.. Try Dim strempno As String Dim rs As OracleAccess.clsOracleConnection ...
3
2894
by: Peter Kanurer | last post by:
I thought "using System.DataAccess.Client" would contain all necessary stuff for OracleConnection, OracleCommand and OracleDataReader objects but this is not the case. They are still unresolved after adding. Do I have to install a separate package or enable Oracle specific extensions somewhere in VisualStudio 2005 (Express) ?
2
9628
by: Werner Sammer | last post by:
I tried to connect to an existing Oracle Database with the following ConnectionString: using System.Data.OracleClient; // + Added Reference "System.Data.OracleClient" string cs = "Data Source=XE;User Id=karl;Password=mypasswd"; connection = new OracleConnection(cs); connection.Open(); This code yields an "Invalid argument" ORA-12532 error.
1
17639
by: walterb | last post by:
I had a hard time finding this information on the web, so I decided to post it here for someone else. I was finding it difficult to locate information on the proper method to store the database username and password in the web.config file, but reference it in my C# code while using ODP.NET. The problem was how to get the OracleConnection to use the connectionString in the web.config file. The trick is to use the...
7
1765
by: BiffMaGriff | last post by:
I have an query I run against an Oracle Connection. I have these objects, an event table and a table to map my objects to my events. My select statement selects the most recent event for each object and if it meets certain requirements then the object's id is returned. something like select o.id from objects o, events e, objecteventmap oem, (select max(date), o.id from events e, objects o, objecteventmap oem where e.id = oem.eventid...
0
10335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11599
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12005
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10303
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6648
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6827
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4937
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3964
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.