Closing ODBCConnections

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zacks@construction-imaging.com

    #1

    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?

  • Sambantham Kuppusamy

    #2
    Re: Closing ODBCConnections

    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.

    <zacks@construc tion-imaging.comwrot e in message
    news:1188487127 .154382.83260@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?
    >

    Comment

    • rowe_newsgroups

      #3
      Re: Closing ODBCConnections

      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:1188487127 .154382.83260@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

      Comment

      • Sambantham Kuppusamy

        #4
        Re: Closing ODBCConnections

        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" <rowe_email@yah oo.comwrote in message
        news:1188490808 .109616.259820@ 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:118848712 7.154382.83260@ 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
        >

        Comment

        • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

          #5
          Re: Closing ODBCConnections

          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

          Comment

          • =?ISO-8859-1?Q?Arne_Vajh=F8j?=

            #6
            Re: Closing ODBCConnections

            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

            Comment

            Working...