473,915 Members | 6,883 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Closing ODBCConnections

If I close and dispose an ODBCConnection object, shouldn't the
connection actually close? I have found that even after closing and
disposing an ODBCConnection, the database it was connected to still
has an active connection as long as the application is still running.
I have to close the application to actually close the active
connection to the database. Is this normal behaviour? Is there a way
to really close the connection while the application is still running?

Aug 30 '07 #1
5 2369
Yes it is. The ODBC connection is a pool and will be active for some time
usually 15 minutes and another request can use it.
This is how ODBC works and when the application is closed normally all the
pooled ODBC connections are closed.

<za***@construc tion-imaging.comwrot e in message
news:11******** *************@k 79g2000hse.goog legroups.com...
If I close and dispose an ODBCConnection object, shouldn't the
connection actually close? I have found that even after closing and
disposing an ODBCConnection, the database it was connected to still
has an active connection as long as the application is still running.
I have to close the application to actually close the active
connection to the database. Is this normal behaviour? Is there a way
to really close the connection while the application is still running?

Aug 30 '07 #2
On Aug 30, 11:46 am, "Sambantham Kuppusamy" <sambanth...@ho tmail.com>
wrote:
Yes it is. The ODBC connection is a pool and will be active for some time
usually 15 minutes and another request can use it.
This is how ODBC works and when the application is closed normally all the
pooled ODBC connections are closed.

<za...@construc tion-imaging.comwrot e in message

news:11******** *************@k 79g2000hse.goog legroups.com...
If I close and dispose an ODBCConnection object, shouldn't the
connection actually close? I have found that even after closing and
disposing an ODBCConnection, the database it was connected to still
has an active connection as long as the application is still running.
I have to close the application to actually close the active
connection to the database. Is this normal behaviour? Is there a way
to really close the connection while the application is still running?
If I'm not mistaken, doesn't calling GC.Collect() also clear out the
ODBC connection pool?

Thanks,

Seth Rowe

Aug 30 '07 #3
if you use Oledb connection using ADO.net instead of odbc you can have a
better control of closing the connections yourself.

"rowe_newsgroup s" <ro********@yah oo.comwrote in message
news:11******** **************@ o80g2000hse.goo glegroups.com.. .
On Aug 30, 11:46 am, "Sambantham Kuppusamy" <sambanth...@ho tmail.com>
wrote:
>Yes it is. The ODBC connection is a pool and will be active for some time
usually 15 minutes and another request can use it.
This is how ODBC works and when the application is closed normally all
the
pooled ODBC connections are closed.

<za...@constru ction-imaging.comwrot e in message

news:11******* **************@ k79g2000hse.goo glegroups.com.. .
If I close and dispose an ODBCConnection object, shouldn't the
connection actually close? I have found that even after closing and
disposing an ODBCConnection, the database it was connected to still
has an active connection as long as the application is still running.
I have to close the application to actually close the active
connection to the database. Is this normal behaviour? Is there a way
to really close the connection while the application is still running?

If I'm not mistaken, doesn't calling GC.Collect() also clear out the
ODBC connection pool?

Thanks,

Seth Rowe

Aug 30 '07 #4
Sambantham Kuppusamy wrote:
if you use Oledb connection using ADO.net instead of odbc you can have a
better control of closing the connections yourself.
What is the difference ?

Docs for OdbcConnection say:

Note
To deploy high-performance applications, you frequently must use
connection pooling. However, when you use the .NET Framework Data
Provider for ODBC, you do not have to enable connection pooling because
the provider manages this automatically.

Docs for OleDbConnection says:

Note
To deploy high-performance applications, you must use connection
pooling. When you use the .NET Framework Data Provider for OLE DB, you
do not have to enable connection pooling because the provider manages
this automatically.

The wording is slightly different, but the substance seems identical.

Arne
Sep 3 '07 #5
rowe_newsgroups wrote:
If I'm not mistaken, doesn't calling GC.Collect() also clear out the
ODBC connection pool?
GC releases memory for objects that are unreachable.

The connections is a connection pool are obvious
reachable.

Arne

Sep 3 '07 #6

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

Similar topics

5
2267
by: Ron L | last post by:
I have an MDI application with a number of child windows. In each child window I am catching the Closing event and having the child window decide if it should set cancel to true. The intent here is to ensure that no child window can close while it is in a state where user entered information can be lost. I have just noticed that while the Closing event is caught if I click the X on the child window, it is not caught if I click the X on...
1
5835
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the MDI child window. My application does certain logic when the user actually closes the MDI child form by clicking the "X" in the upper right hand. My application, however, should not execute this logic if the user closes the MDI parent. I...
6
5672
by: Al the programmer | last post by:
I want to catch the Closing event for my form. I created a test windows app using the wizard. I then create the Closing event by clicking the lightning bolt on the properties pane. The code is added to the app but my app won't compile. It generates a "Test.Form1.Closing() denotes a 'method' which is not valid in the given context" error.
1
2209
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
10
4042
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the application. What should happen, is that the main MDI form should close, taking the child forms with it. There is code to loop through the child forms, remove the controls on each of them, and then close the form, but this code should execute only...
2
3028
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then and then attempts to close the window (either via my custom 'Close' box or by clicking the close 'X' in the upper right window corner), the validation event still triggers and it tells the user that they have invalid data. Which of course means...
4
3016
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in one Closing routine he will not be asked again by another when its form Closing routine is run? I guess what I'm asking is will that work. If one form sets e.cancelled to true will e.cancel be true when the next form receives a closing event?
1
1689
by: Paul Rubin | last post by:
it looks like contextlib.closing fails to be idempotent, i.e. wrapping closing() around another closing() doesn't work. This is annoying because the idea of closing() is to let you use legacy file-like objects as targets of the "with" statement, e.g. with closing(gzip.open(filename)) as zf: ... but what happens if the gzip library gets updated the dumb way to
5
1227
by: zacks | last post by:
If I close and dispose an ODBCConnection object, shouldn't the connection actually close? I have found that even after closing and disposing an ODBCConnection, the database it was connected to still has an active connection as long as the application is still running. I have to close the application to actually close the active connection to the database. Is this normal behaviour? Is there a way to really close the connection while the...
0
10039
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10923
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
11066
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
9732
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...
1
8100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7256
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
5943
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
6148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4344
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.