473,230 Members | 1,411 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

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 2341
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***@construction-imaging.comwrote in message
news:11*********************@k79g2000hse.googlegro ups.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...@hotmail.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...@construction-imaging.comwrote in message

news:11*********************@k79g2000hse.googlegro ups.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_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
On Aug 30, 11:46 am, "Sambantham Kuppusamy" <sambanth...@hotmail.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...@construction-imaging.comwrote in message

news:11*********************@k79g2000hse.googlegr oups.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
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...
1
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...
6
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...
1
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
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...
2
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...
4
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...
1
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...
5
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...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.