471,305 Members | 1,278 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,305 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 2255
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Ron L | last post: by
1 post views Thread by Chris Bruce | last post: by
6 posts views Thread by Al the programmer | last post: by
1 post views Thread by Paul Rubin | last post: by
5 posts views Thread by zacks | last post: by

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.