473,503 Members | 1,655 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection Pooling

Hi,

I'm using asp.net 2 with an sql server 2000 database. What steps if
any, must I take to ensure connection pooling efficiently?

for any 'manual' connections made, I open the sqlconnection obtaining
the connection string from configurationmanager.connectionstrings, and
close the connection as soon as it's been finished with.

I haven't run any tests yet but just wondered if there's something I
should be doing at this stage to help in the future.

Cheers,
Chris

Jan 24 '06 #1
9 5696
Hi Chris,

Sounds like you're in good shape. The .Net platform will handle the pooling,
and as long as you close your connections immediately, as you're doing now,
you will get the best performance out of it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Who is Mighty Abbott?
A twin turret scalawag.

"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
Hi,

I'm using asp.net 2 with an sql server 2000 database. What steps if any,
must I take to ensure connection pooling efficiently?

for any 'manual' connections made, I open the sqlconnection obtaining the
connection string from configurationmanager.connectionstrings, and close
the connection as soon as it's been finished with.

I haven't run any tests yet but just wondered if there's something I
should be doing at this stage to help in the future.

Cheers,
Chris

Jan 24 '06 #2
Are you using SQL Authentication in your connection string? if so, ur good
to go as-is. If you are using windows imporsonation then each user will have
his/her own connection string which won't allow it to pool.

Karl

--
http://www.openmymind.net/

"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
Hi,

I'm using asp.net 2 with an sql server 2000 database. What steps if any,
must I take to ensure connection pooling efficiently?

for any 'manual' connections made, I open the sqlconnection obtaining the
connection string from configurationmanager.connectionstrings, and close
the connection as soon as it's been finished with.

I haven't run any tests yet but just wondered if there's something I
should be doing at this stage to help in the future.

Cheers,
Chris

Jan 24 '06 #3
Karl Seguin [MVP] wrote:
Are you using SQL Authentication in your connection string? if so, ur good
to go as-is. If you are using windows imporsonation then each user will have
his/her own connection string which won't allow it to pool.


ooh, this bit I'm not so sure on as I don't manage the servers. Without
using the proper terminology what I think is happening is that the IIS
server is running the page as a specific windows user, so that when
using integrated security, it checks the sql server credentials of that
(windows) user, which of course holds valid permissions.

When you say SQL authentication do you mean having a user/login
hard-coded into the SQL server? I understood the windows authentication
is more secure?

Ta for the help,
Chris
Jan 24 '06 #4
Yes, that's what I mean when I say SQL authentication (SQL Server has it's
own authentication capabilities as well as using windows username/password).
I'm not sure which is more secure.

What I can tell you is:

If you are using Windows Authentication you may or not has a problem.

If you are using Windows Authentication with ASP.NET impersonation turned
on, then I don't believe pooling will happen. you can find out by going into
the web.config. If this is a public internet site, then you don't have
impersonation turne don. If it's a private intranet site where all users are
on the same domain, it's possible that you are using impersonation.

If you are using Windows Authentication with ASP.NTE impersonation turned
OFF, then pooling will happen. This simply means that you've granted the
ASP.NET account access to your sql server and that each connection will be
made by the ASP.NET account (thus enabling pooling). In the case mentioned
above, the creditials for each request is based on the server, so if 10
different people access the site, then you'll have 10 different pools - no
ideal.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
Karl Seguin [MVP] wrote:
Are you using SQL Authentication in your connection string? if so, ur
good to go as-is. If you are using windows imporsonation then each user
will have his/her own connection string which won't allow it to pool.


ooh, this bit I'm not so sure on as I don't manage the servers. Without
using the proper terminology what I think is happening is that the IIS
server is running the page as a specific windows user, so that when using
integrated security, it checks the sql server credentials of that
(windows) user, which of course holds valid permissions.

When you say SQL authentication do you mean having a user/login hard-coded
into the SQL server? I understood the windows authentication is more
secure?

Ta for the help,
Chris

Jan 24 '06 #5
It is more secure.

What Karl meant (I guess) was that if you use Impersonation (your
ASP.NET code then is executed under the authorized user) the connection
to the database is made using the authorized user (same as ASP.NET code
is executed).

--Daniel
http://staff.newtelligence.com/danielf/

-----Original Message-----
From: Not Me [mailto:no****@zxy.blah.org]
Posted At: Tuesday, January 24, 2006 3:49 PM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Connection Pooling
Subject: Re: Connection Pooling

Karl Seguin [MVP] wrote:
Are you using SQL Authentication in your connection string? if so, ur good to go as-is. If you are using windows imporsonation then each user will have his/her own connection string which won't allow it to pool.


ooh, this bit I'm not so sure on as I don't manage the servers. Without

using the proper terminology what I think is happening is that the IIS
server is running the page as a specific windows user, so that when
using integrated security, it checks the sql server credentials of that
(windows) user, which of course holds valid permissions.

When you say SQL authentication do you mean having a user/login
hard-coded into the SQL server? I understood the windows authentication

is more secure?

Ta for the help,
Chris

Jan 24 '06 #6
Karl Seguin [MVP] wrote:
Yes, that's what I mean when I say SQL authentication (SQL Server has it's
own authentication capabilities as well as using windows username/password).
I'm not sure which is more secure.

What I can tell you is:

If you are using Windows Authentication you may or not has a problem.

If you are using Windows Authentication with ASP.NET impersonation turned
on, then I don't believe pooling will happen. you can find out by going into
the web.config. If this is a public internet site, then you don't have
impersonation turne don. If it's a private intranet site where all users are
on the same domain, it's possible that you are using impersonation.

If you are using Windows Authentication with ASP.NTE impersonation turned
OFF, then pooling will happen. This simply means that you've granted the
ASP.NET account access to your sql server and that each connection will be
made by the ASP.NET account (thus enabling pooling). In the case mentioned
above, the creditials for each request is based on the server, so if 10
different people access the site, then you'll have 10 different pools - no
ideal.


Thanks for trying to clear this up.. so is ASP.net impersonation where
it takes the credentials of the machine that is trying to access the
page, and uses those details to authenticate against the sql server?
This will be a public site so I'm not interested in that.. so hopefully
there shouldn't be any issues with the pooling.

cheers,
Chris
Jan 24 '06 #7
Looks like you have it right :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
Karl Seguin [MVP] wrote:
Yes, that's what I mean when I say SQL authentication (SQL Server has
it's own authentication capabilities as well as using windows
username/password). I'm not sure which is more secure.

What I can tell you is:

If you are using Windows Authentication you may or not has a problem.

If you are using Windows Authentication with ASP.NET impersonation turned
on, then I don't believe pooling will happen. you can find out by going
into the web.config. If this is a public internet site, then you don't
have impersonation turne don. If it's a private intranet site where all
users are on the same domain, it's possible that you are using
impersonation.

If you are using Windows Authentication with ASP.NTE impersonation turned
OFF, then pooling will happen. This simply means that you've granted the
ASP.NET account access to your sql server and that each connection will
be made by the ASP.NET account (thus enabling pooling). In the case
mentioned above, the creditials for each request is based on the server,
so if 10 different people access the site, then you'll have 10 different
pools - no ideal.


Thanks for trying to clear this up.. so is ASP.net impersonation where it
takes the credentials of the machine that is trying to access the page,
and uses those details to authenticate against the sql server? This will
be a public site so I'm not interested in that.. so hopefully there
shouldn't be any issues with the pooling.

cheers,
Chris

Jan 24 '06 #8
Any idea where and how we can limit the number of connections to SQL
Server ? Lets say a request comes for accessing the database and all
the connections are in use. The request needs to wait until a
connection is dropped so it can use it. The idea is to limit the number
of connections to the database to some value for example 5 or 10 etc.
at any point.
Phani
Karl Seguin [MVP] wrote:
Looks like you have it right :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
Karl Seguin [MVP] wrote:
Yes, that's what I mean when I say SQL authentication (SQL Server has
it's own authentication capabilities as well as using windows
username/password). I'm not sure which is more secure.

What I can tell you is:

If you are using Windows Authentication you may or not has a problem.

If you are using Windows Authentication with ASP.NET impersonation turned
on, then I don't believe pooling will happen. you can find out by going
into the web.config. If this is a public internet site, then you don't
have impersonation turne don. If it's a private intranet site where all
users are on the same domain, it's possible that you are using
impersonation.

If you are using Windows Authentication with ASP.NTE impersonation turned
OFF, then pooling will happen. This simply means that you've granted the
ASP.NET account access to your sql server and that each connection will
be made by the ASP.NET account (thus enabling pooling). In the case
mentioned above, the creditials for each request is based on the server,
so if 10 different people access the site, then you'll have 10 different
pools - no ideal.


Thanks for trying to clear this up.. so is ASP.net impersonation where it
takes the credentials of the machine that is trying to access the page,
and uses those details to authenticate against the sql server? This will
be a public site so I'm not interested in that.. so hopefully there
shouldn't be any issues with the pooling.

cheers,
Chris


Jan 25 '06 #9
There is a Max Pool Size property to the connection string, but I
reallywouldn't recommend you play with it unless you really know what youa
re doing.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Phani" <ph***********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
Any idea where and how we can limit the number of connections to SQL
Server ? Lets say a request comes for accessing the database and all
the connections are in use. The request needs to wait until a
connection is dropped so it can use it. The idea is to limit the number
of connections to the database to some value for example 5 or 10 etc.
at any point.
Phani
Karl Seguin [MVP] wrote:
Looks like you have it right :)

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Not Me" <no****@zxy.blah.org> wrote in message
news:dr**********@ucsnew1.ncl.ac.uk...
> Karl Seguin [MVP] wrote:
>> Yes, that's what I mean when I say SQL authentication (SQL Server has
>> it's own authentication capabilities as well as using windows
>> username/password). I'm not sure which is more secure.
>>
>> What I can tell you is:
>>
>> If you are using Windows Authentication you may or not has a problem.
>>
>> If you are using Windows Authentication with ASP.NET impersonation
>> turned
>> on, then I don't believe pooling will happen. you can find out by
>> going
>> into the web.config. If this is a public internet site, then you don't
>> have impersonation turne don. If it's a private intranet site where
>> all
>> users are on the same domain, it's possible that you are using
>> impersonation.
>>
>> If you are using Windows Authentication with ASP.NTE impersonation
>> turned
>> OFF, then pooling will happen. This simply means that you've granted
>> the
>> ASP.NET account access to your sql server and that each connection
>> will
>> be made by the ASP.NET account (thus enabling pooling). In the case
>> mentioned above, the creditials for each request is based on the
>> server,
>> so if 10 different people access the site, then you'll have 10
>> different
>> pools - no ideal.
>
> Thanks for trying to clear this up.. so is ASP.net impersonation where
> it
> takes the credentials of the machine that is trying to access the page,
> and uses those details to authenticate against the sql server? This
> will
> be a public site so I'm not interested in that.. so hopefully there
> shouldn't be any issues with the pooling.
>
> cheers,
> Chris

Jan 26 '06 #10

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

Similar topics

1
2809
by: Mithun Verma | last post by:
Hello All, I am working on a windows application which will talk to the database through the Web services. So i need to enhaance the performance, for which i m using connection
5
12721
by: John | last post by:
Does COM.ibm.db2.jdbc.DB2DataSource, (which supports connection pooling) need to be run within a J2EE container environment before the connection pooling facility is actually available to a user? ...
18
3204
by: Rob Nicholson | last post by:
We're getting an occasional occurrence of the following error when two users try and open the same record in our ASP.NET app: "There is already an open DataReader associated with this Connection...
1
5705
by: Lenny Shprekher | last post by:
Hi, I am getting issues that Oracle collecting opened sessions (connections) from my webservice using regular System.Data.OleDb.OleDbConnection object. I am guessing that this is connection...
2
2328
by: JimLad | last post by:
Hi, In an existing ASP/ASP.NET 1.1 app running on IIS 6, I need to RELIABLY pass the logged in username through to the SQL Server 2000 database for auditing purposes. The current method is...
16
2843
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
20
3242
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
4876
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
0
6575
viswarajan
by: viswarajan | last post by:
Introduction This article is to go in deep in dome key features in the ADO.NET 2 which was shipped with VS 2005. In this article I will go trough one of the key features which is the Connection...
15
3252
by: Sylvie | last post by:
I have a static function in a class, everytime I call this function, I am creating a SQLconnection, open it, use it, and null it, All my functions and application logic is like this, Every...
0
7201
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
7278
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
7328
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
5578
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,...
1
5011
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...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
379
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.