The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

"Using" statement in VistaDB/ES connection?

Last post 01-11-2008, 9:27 AM by Mike.Griffin. 4 replies.
Sort Posts: Previous Next
  •  01-10-2008, 8:36 PM 7583

    "Using" statement in VistaDB/ES connection?

    Does ES use the "using" statement (i.e. using( VistaDBConnection dbConn = new VistaDBConnection(connectionString) )) by default?

    According to the VistaDB 3.3.1.50 build documentation, if connection pooling is used, it is recommended to use the using statment to automatically tear down the object. If not, VistaDBConnection.ClearAllPools() should be called to clear out the connection pools.

    [FROM HELP FILE] 
    "In general connections should be treated either as a global that you lock and manage yourself, or opened with using statements and torn down as quickly as possible. Connection pool settings may be set in the connection string, or through the properties of the VistaDBConnectionStringBuilder. See this topic for more information."

    "It is very important to clear the connection pools before application shutdown. Notice in the NUnit tests we call these methods to force releasing of all connection pools in several locations." 

    // Release all the connection pools
    VistaDBConnection.ClearAllPools();

     

     

  •  01-11-2008, 8:32 AM 7586 in reply to 7583

    Re: "Using" statement in VistaDB/ES connection?

    We currently call Connection.Close() only. I was unaware of this issue as it's not really true in general for ADO.NET providers. While we cannot using the "using" syntax we will find out if need to also call Dispose() which is what the using syntax calls. I'm not sure however that we have a problem here but we will make sure we follow VistaDB's recommendations. I remember when they didn't support connection pooling at all and you had to open a single connection and keep it open for the life of the application. It was upon our request really that they began to feel the pressure to implement connection pooling. As for the ClearAllPools() you will have to call that directly for now, perhaps we can build a Initialize/Release methods into our providers and hide this aspect.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
  •  01-11-2008, 9:14 AM 7587 in reply to 7586

    Re: "Using" statement in VistaDB/ES connection?

    Mike,

    Can you also contact Jason directly regarding the usage of connection pooling with VistaDB? The help file makes sense with a winform application if you are opening the connection at the start of the app and closing it at the exit of the app. You want to make sure you reclaim the resources. However, with ASP.NET (stateless) and ES, if you called the the ClearAllPools() on the Close() or Dispose(), wouldnt that clear all of the pools each time you run a query with and ES object? This would defeat the connection pooling. I am thinking that the connection pooling needs to clean up by default from within VisaDB based on a timed interval or setting from the connection string. Then if also have the option to call ClearAllPools() to manually clear the pools.

     

  •  01-11-2008, 9:24 AM 7588 in reply to 7587

    Re: "Using" statement in VistaDB/ES connection?

    Here is also a Blog link where VistaDB did some testing with connection pooling.

    http://www.vistadb.net/blog/?p=111

  •  01-11-2008, 9:27 AM 7589 in reply to 7587

    Re: "Using" statement in VistaDB/ES connection?

    Yes, I will contact him. ES would never call ClearAppPools, the user would have to do that in their application, in web apps this would happen in the global.asax page in the shutdown event. ClearAllPools really cannot be called by VistaDB or ES, this is an application thing that it must call when shutting down. Honestly, the connection pooling isn't quite right here as no other .NET providers that I know of (and I have used them all) have this requirement. However, we will test when we upgrade to their new version an add support for VistaDB stored procedures and such. But yes, I will talk to Jason and make sure we know exactly what we need to do.

    EntitySpaces | Twitter | BLOG | Please honor our Software License
View as RSS news feed in XML