473,414 Members | 1,665 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Database Connections

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
Nov 19 '05 #1
2 958
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

Nov 19 '05 #2
Tom,

SqlConnection is not the same as a database connection when connection
pooling is enabled, so as long as your connection (sqlconnection) instance
is kept open for the least amount of possible, your db server won't die.

Here is something i wrote a while back on how it all works under the seams.

http://codebetter.com/blogs/sahil.ma.../12/31798.aspx
--

- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
----------------------------------------------------------------------------
---------------

"Tom John" <news[at]decsixth[dot]co[dot].uk> wrote in message
news:ko********************************@4ax.com...
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
4
by: dustin lee | last post by:
Over the years I've gotten out of the habit of explicitly closing file objects (whether for reading or writing) since the right thing always seems to happen auto-magically (e.g. files get written...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
4
by: Sierra | last post by:
Problem: Database connections are not being reused properly. SP_WHO2 shows upwards of 200 connections being created per page request. Most connections exist for 60 seconds then close without...
7
by: Martin | last post by:
Hello Does anyone know if it is possible to use the smo db.Create() method to create a new sql server database with sql server 2005 express? The debugger complains that remote operations are not...
5
by: John | last post by:
I have an ASP.NET 2.0 application developed in VB.net, that accesses an Microsoft Access database. When the database is on the same IIS server all works just fine. BUT when it tried to access the...
5
by: Usman Jamil | last post by:
Hi I've a class that creates a connection to a database, gets and loop on a dataset given a query and then close the connection. When I use netstat viewer to see if there is any connection open...
8
by: BD | last post by:
I am developing C# win form app to work with remote database on SQL Server 2005. Problem scenario is as follows: 1. a form is open that has downloaded dataset to local cache 2. computer is...
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.