Database connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deegeorge
    New Member
    • Nov 2008
    • 58

    Database connection

    Hi, I am creating two different DB connections and i am not closing both the connection. What will happen. What is happening internally.
  • lttan123
    New Member
    • Oct 2008
    • 11

    #2
    basically the connection is still open and will eat up system resources which will eventually slow down your system.

    Comment

    • deegeorge
      New Member
      • Nov 2008
      • 58

      #3
      Originally posted by lttan123
      basically the connection is still open and will eat up system resources which will eventually slow down your system.
      Thanks for reply and one more doubt is that, will it create any other problem

      Comment

      • prasadgvl
        New Member
        • Nov 2008
        • 3

        #4
        That is a very vague question. Please try to be specific on what you are looking for.

        If your application is web-based, you'll end up SQL server denying any new connections after a while. This is because, for every instance of the application (user) two connections will be left open.

        Comment

        • PRR
          Recognized Expert Contributor
          • Dec 2007
          • 750

          #5
          Assuming the connection strings are different : 2 connections pool will be created on your DB server, as soon as you call connection.open ...
          If you dont close your connection the open connections wont be returned to pool.. so DB server will suffer. Performance will be hit ...
          "When the connection is closed, it is returned to the pool where it remains connected to the database, as opposed to completely tearing down that TCP connection.
          Of course you need to watch out for leaking connections. Always close your connections when you're finished with them. I repeat: no matter what anyone says about garbage collection within the Microsoft® .NET Framework, always call Close or Dispose explicitly on your connection when you are finished with it. Do not trust the common language runtime (CLR) to clean up and close your connection for you at a predetermined time. The CLR will eventually destroy the class and force the connection closed, but you have no guarantee when the garbage collection on the object will actually happen."
          Rob Howard

          Comment

          Working...