Dofactory.com
Dofactory.com
 Back to list
Views:   9.3K
Replies:  4
Archived

reducing sql connections & connection pools

Hi,
What is the philosophy with connection pools in do factory? It seems we make a connection on every query. Is there a way to use connection pools? Or is that a bad idea?

Is this addressed in the SQL Database Pattern Framework?

Thanks,

Alan
Alan Anderson, Jan 28, 2016
Reply 1
Thanks for the answers guys. This helps me think this through a bit. From my understanding, connection pooling is happening in ADO.NET and since do factory is using ADO.Net, then it just magically happens for me. Does that sound right?

https://msdn.microsoft.com/en-us/library/8xx3tyca(v=vs.110).aspx

Again, thanks for the answers.

Alan
Alan Anderson, Feb 19, 2016
Reply 2
If i understand correctly your questions you can do something like this:

Create a list where you can store the connectios you have already created 

Then when you want to "create" a connection you can check the list (your pool) to see if there is already an existing connection and take it from there so you don't have to create a new one.

If the connection does not exist add it to the list and that's how you can have you pool of connections and not create a new one each time you want to query the database.

Example:
[ThreadStatic]
        private static List<ConnectionSettings> PoolContext;

var connectionSettings = PoolContext.Find(o => o.ProviderName == pConnectionSettings.ProviderName && o.ServerName == pConnectionSettings.ServerName && o.UserID == pConnectionSettings.UserID);
I Hope it helps. Regards
 
Ramon Aguilar, Feb 18, 2016
Reply 3
I didn't understand your question - "What is the philosophy with connection pools in do factory"

Thanks.
Mukta Madankar, Jan 29, 2016
Reply 4
Connection pooling is handled by the database drivers themselves.  
You can configure this (on the connectionstring), but generally you should not have to change this.. 

Hope this helps.
Jack
Jack Poorte, Jan 29, 2016
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.