PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Re: 37 Connection Pools - 1 Connection String

Reply

Re: 37 Connection Pools - 1 Connection String

 
Thread Tools Rate Thread
Old 21-03-2005, 07:51 PM   #1
Angel Saenz-Badillos[MS]
Guest
 
Posts: n/a
Default Re: 37 Connection Pools - 1 Connection String


You can check the connections in the server programatically if your app has
the right permissions) with :
"select count(*) from master.dbo.sysprocesses"

A trick I like to use is to add a unique Workstation id to the connection
string of the pool I want to track, so I do something like this:
Guid workstationId = new Guid();
ConnectionString=ConnectionString+"Workstation Id='"+ workstationId +"'";
//note the single quotes arround the guid

Then I can find only the connections in the pool like this:
"select count(*) from master.dbo.sysprocesses WHERE hotname=
'"+workstationId+"'" ; //note the single quotes arround the guid.

Hope this helps,
--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/




"Sean Nolan" <seann@imgno%spaminc.com> wrote in message
news:eKWzn#$KFHA.1136@TK2MSFTNGP10.phx.gbl...
> I'm sure there are probably some components out there (but I don't know of
> one off hand) - you're meaning tools that you can code into your app

right?
> The things I mentioned before (and the Performance Monitor, which I

didn't)
> are all good ways to do it at the system monitoring level.
>
> One thing to note is that there is no way for you to explicitly close
> connections that are pooled. When you call Close on a connection, what you
> are really doing is putting it back in the pool. If you do not call Close,
> it will not be returned to the pool, so when a new connection is requested
> from the pool a new one will have to be added (and hence you get another
> real connection to SQL Server). If you do that enough times (100 by

default)
> you'll eventually reach the pool max and then you will start getting
> exceptions. You can pick that up pretty quickly by monitoring the number

of
> connections to SQL Server.
>
> Sean
>
> "Elroyskimms" <elroyskimms@yahoo.com> wrote in message
> news:1111179795.672031.254940@f14g2000cwb.googlegroups.com...
> > Sean,
> >
> > I had one PID of 52, and that was it...
> > Is there a tool that will show me open connections? As much as I try
> > and close all connections before leaving their scope, I can't say that
> > I'm perfect. It would be nice to get an accurate count of open
> > connections so that I can debug individal code blocks properly. Any
> > thoughts?
> >
> > -A
> >

>
>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off