Database Connections

T

Tom John

Hi

I have a data access layer that provides static functions between my
business logoc and an Access database. The connection string to the
database never changes.

Currently I carefully open and close a connection to the database at
the begining of each method in the dataacces layer. But am not sure
this is the best method, I went this way because i read somewhere in
web apps connections should be kept open for as short a period as
possible.

If i have multiple sessions on the go on the web server i worry that
there are lot of connections opening and closing that could be shared.

Can anyone advise

Thanks

Tom
 
P

Phillip Ian

You might want to look at the connection pooling information in help.
ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpguide/html/cpconconnectionpoolingforsqlservernetdataprovider.htm
(not sure these links work, but it seems like it should).

The gist is, if you keep the connection string constant, ADO.NET will
manage connection pooling for you. It will pool and re-use connections
across sessions. If you find that the pooling system doesn't work to
your satisfaction, you can tune it by adding some commands to the
command string.

-Phil
 

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

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top