SQL Connections .Net SqlClient Data Provider

  • Thread starter Silvia Brunet Jones
  • Start date
S

Silvia Brunet Jones

When using the trace log set to audit login information
when debugging connections I observed that my connection
through asp.net event class audit logout doesnt happen as
soon as I call .close or even .dispose. It happens after
several minutes I am supposing when the connection times
out. Why? Why is the connection not being closed. The
audit logout event doesnt happen right after the audit
login when I am actually closing the connection immediatly.
EXPLANATION PLEASE.
 
J

Joe Fallon

Ditto.
When you call conn.Close you are closing your connection object not the
physical connection.
 
J

Jeff Woodie

What you will want to be aware of is your connection string when connecting
to the database. If you can make sure that this connection string is static
(ie. exactly the same each time you connect from your application - store
this in an application variable or something like that and reference it so
it is always the same) then this will allow you to take advantage of the
huge performance gains from connection pooling. If you can ensure this then
there is no reason not to use the default behavior. If, however, your
application uses a dynamic connection string that changes with each user for
instance (and you've got a good number of concurrent users) then this might
be something you will want to explore further. If you're using a single
connection string however (which is the determining factor in whether a
"live" connection gets reused) then there's just no reason to try and get
around this default behavior.

Jeff Woodie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top