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

SQL Server Pooling in ASP.NET

Hi All
I am getting following the Error when I am running my web application(C#)
using the SQL Server as my Database. Frequent clicks on multiple links
causes this error.
ERROR: "Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached."

My Web.config is as follows:
<add key="SQLdbConnString"
value="server=192.168.0.XXX;uid=sa;pwd=xx;database =xxxxxx;Min Pool
Size=5;Max Pool Size=40;"/>
I'm using the SQLHelper Class to connect to the database.
private static void PrepareCommand(SqlCommand cmd, SqlConnection conn,
SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[]
cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}

Please suggest a way to handle the problem.

Adv Thanks

Venu.
Nov 17 '05 #1
2 1298
karunakar wrote:
Hi All
I am getting following the Error when I am running my web application(C#)
using the SQL Server as my Database. Frequent clicks on multiple links
causes this error.
ERROR: "Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached."

My Web.config is as follows:
<add key="SQLdbConnString"
value="server=192.168.0.XXX;uid=sa;pwd=xx;database =xxxxxx;Min Pool
Size=5;Max Pool Size=40;"/>
I'm using the SQLHelper Class to connect to the database.
private static void PrepareCommand(SqlCommand cmd, SqlConnection conn,
SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[]
cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}

Please suggest a way to handle the problem.

Adv Thanks

Venu.


You left out some code. I don't see where you execute the command,
and more importantly, I don't see where you *close* the connection.

The errormessage says that there are too many opened connections. The
solution is to close the connection as soon as you are done with it. You
might even use a try/finally (the execute in the "try", the close in the
"finally") to be really sure the connection will close.
--
Hans Kesting
Nov 17 '05 #2
As Hans suggested, you're not showing where you close the connection when
you're done with it. You should ALWAYS call the .Close() method when using a
DataReader, otherwise you'll end up with the error you received.
"karunakar" <ka***********@stcroixsystems.com> wrote in message
news:OE**************@TK2MSFTNGP10.phx.gbl...
Hi All
I am getting following the Error when I am running my web
application(C#)
using the SQL Server as my Database. Frequent clicks on multiple links
causes this error.
ERROR: "Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached."

My Web.config is as follows:
<add key="SQLdbConnString"
value="server=192.168.0.XXX;uid=sa;pwd=xx;database =xxxxxx;Min Pool
Size=5;Max Pool Size=40;"/>
I'm using the SQLHelper Class to connect to the database.
private static void PrepareCommand(SqlCommand cmd, SqlConnection conn,
SqlTransaction trans, CommandType cmdType, string cmdText, SqlParameter[]
cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (SqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}

Please suggest a way to handle the problem.

Adv Thanks

Venu.

Nov 17 '05 #3

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

Similar topics

0
by: Shireesha | last post by:
Hi all, I am new to this group and wish clear some doubts regarding tomcat server and database connection pooling (Java language). Our group has developed a application using Tomcat 4.x. We need...
5
by: Florin | last post by:
Hi, I am experiencing some problems accessing an Oracle database through OLE DB from an MTS application using OpenWithServiceComponents (which is supposed to give me connection pooling). When I...
1
by: rob | last post by:
Hello, Newbie of sorts. Been reading up on best practices though. I'm trying to optimize performance to the SQL DB vs. the Web server and an ASP application. I've read that you're supposed to...
6
by: Mark | last post by:
Where is the connection pooling done when using ADO.NET and SQL Server? On the SQL Server or where the .NET run-time is being executed? I'm assuming on SQL Server as this would minimize the...
3
by: hussein | last post by:
'm not bale to run my projec on the 2000 server, he error was: error while trying to run project: unable to start debugging on the web server.erver side error occurred on sending debug HTTP request...
1
by: Vb2Machines | last post by:
Hello, I am in the process of building a web service that will connect to my sql server for data retrieval only. It will have to handle requests from multiple apps on our shop floor. Roughly 5...
6
by: John J. Hughes II | last post by:
I have an application that connects to an SQL server. I need to be able to disconnect all connection that I opened. I am closing and disposing the connection but the connection pool is keeping...
4
by: steve | last post by:
Hi All I have a VB.net 2005 application which uses Sql server express 2005 When I read or write data to sql server I always close the connection immediately after finishing using......
0
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...
3
by: =?Utf-8?B?QXho?= | last post by:
Is there a limitation on the number of (sequential) opened connection for SQL Server User Instances? The following method will run to about the 240th iteration then will receive a timeout...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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...

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.