Connection pool and open & close ...??? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Connection pool and open & close ...???

hosssein007hosssein007 Posts: 3Member
How much expensive openning and closing connection is when connection pool is used ???

Assume I invoke four stored procedures in a page , I open and close the connection for invoking each . How much will it affect the performance of that page ??

calling this in a page :

Connection.Open();
//Invoke the stored procedure n1
Connection.Close();

Connection.Open();
//Invoke the stored procedure n2
Connection.Close();

Connection.Open();
//Invoke the stored procedure n3
Connection.Close();

Connection.Open();
//Invoke the stored procedure n4
Connection.Close();


Is it worth replacing it with this. I have made the site like above.It is so hard for me to replace that. What is your suggestion ?


Connection.Open();

//Invoke the stored procedure n1


//Invoke the stored procedure n2


//Invoke the stored procedure n3


//Invoke the stored procedure n4

Connection.Close();


Comments

  • s_sreenaths_sreenath Posts: 20Member
    Definitely it will affect the performance of the page, since each time the application has to switch from app domain to database and vice versa.

    The best way is open the connection once and take as much as data you can from the database and then close the connection.

    My Suggestion open the connection once, execute all the SP's and close the connection.
    "Always Smile :)"
Sign In or Register to comment.