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

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

  • 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.

Howdy, Stranger!

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

Categories

In this Discussion