473,394 Members | 1,761 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,394 software developers and data experts.

Q: Is there a way to se the amount of active sql connections.

Hi!

I am developing an application, and i suspect i am forgetting to close a
connection.

Is there a way to se how many connections that are active to the sql server?

Studio 2008 and SQL Server 2005 Developer is used.

Regards
Martin
Apr 10 '08 #1
5 1198
sp_who or a performance counter are simple ways.

Just note that unless you have disabled connection pooling, it is likely
that when you Close() and Dispose() a SqlConnection (or whatever), that
it actually still remains connected to the SQL Server (i.e. has a spid)
- the reason being that it is kept in the pool for re-use. As long as
this number doesn't keep growing, it is generally fine.

Marc
Apr 10 '08 #2
And re forgetting to close; try "using" the connection - then you can't
forget:

using(SqlConnection conn = new SqlConnection("..."))
{
conn.Open();
// etc
}

Even if an exception happens, the exception should still be released (to
the pool) correctly.

Marc
Apr 10 '08 #3
Is there a way to se how many connections that are active to the sql server?

Should be visible in the SQL server, at least I can check that in
Oracle... clients I mean.. (one or several from one client are treated
as different connections)

//CY
Apr 10 '08 #4
sp_who active
"Martin Arvidsson, Visual Systems AB" <ma**************@vsab.netwrote in
message news:e6****************@TK2MSFTNGP03.phx.gbl...
Hi!

I am developing an application, and i suspect i am forgetting to close a
connection.

Is there a way to se how many connections that are active to the sql
server?

Studio 2008 and SQL Server 2005 Developer is used.

Regards
Martin

Apr 10 '08 #5
>I am developing an application, and i suspect i am forgetting to close a
>connection.
sp_who active
If the problem is that they haven't been closed, then chances are that
they are actually idle - in which case just "sp_who" is probably a safer
bet...

Marc
Apr 10 '08 #6

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

Similar topics

1
by: Steveo | last post by:
Hello, Does anyone know a way to enumerate the active FTP connections on IIS from a C++ prog on Win2K? Steve
3
by: MaRCeLO PeReiRA | last post by:
Hi guys, How can I know about the number of active connections?? (not the maximum allowed, but the number of open connections). Regards, Marcelo Pereira Brasil
1
by: Simon | last post by:
Is there HTTP connection limit of 2 simultaneous connections in webservices? For example what hapens if you use webservices form ASP.NET web application? Presumably ASP.NET is webservices client to...
3
by: Naveen | last post by:
How can we keep track of how many active users are using the application.
20
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataReader. As I read data from tblA, I want to populate tblB. I use SQLDataReader for both tables. I do not use thread. When I ExecuteReader on tblB, I...
10
by: jimmy | last post by:
Hi again, sorry for posting two questions so close together but im working on a school project which is due in soon and running into some difficulties implementing the database parts. I have the...
0
by: Gert Albertse | last post by:
Is it possible to use formsauthentication against Active Directory where the connectionstring queries the GC. I get the following error message: LDAP connections on the GC port are not supported...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
6
by: bill | last post by:
I have been "Googling" for about an hour and am turning up squat! I just started receiving this error when trying to log into a MS Access database from a vb .net web application. Recycling IIS...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.