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

Problem with Timeout and Data Access Blocks

I have a .NET application (actually MCMS, but I think that's irrelevant)
that access a SQL Server database using Microsoft Data Access Blocks (DAB).

Consider the following pseudo-code:

For i = 1 To 10000
SqlHelper.ExecuteNonQuery(strConnection, storedProcType, storedProcName,

params)
Next

This code will cause the classic ODBC timeout error every time after a few
iterations. Now consider this pseudo-code:

Dim oConn as New SqlConnection(strConnection)
oConn.Open
For i = 1 To 10000
SqlHelper.ExecuteNonQuery(oConn, storedProcType, storedProcName, params)
Next

oConn.Close : oConn.Dispose

This works fine. But what's the difference? I've been into the code of DAB
and every call to ExecuteNonQuery does close and dispose the connection.

So my guess is that in the first example, something is not letting go of the

connections fast enough. Yet if I look on the SQL server, there are
virtually no active connections. So where are they being held? What's
causing the timeout?

Now this might seem like an extreme example, but the actual problem I am
having with our application is that in a single HTTP request there is a lot

of database access going on, mostly using the ExecuteNonQuery method in
different functions and event handlers all over the application. The
application is pretty big, it's an Intranet solution for a global financial

services organisation. We've just added a new module that executes every
time an HTTP request is coming in, and we are now getting the timeout errors.

Anyone else experienced this?
Feb 15 '06 #1
1 2113
For some reason MS decided not to close the connections in the code, but to let the garbage collector collect and close the connections used. Due to this the connection stays active for a while after the sql command was completed.
The other thing to be wary of when using the SQLHelper class is that it only uses the default command timeout of around 30sec. This becomes a real pain when you start to run long running queries.
I would suggest to rather use the sqlclient class and code you own wrapper class.
Do it once and you have customizable wrapper class similar to sqlhelper, plus you can step through in debug mode if you wish.
Apr 24 '06 #2

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

Similar topics

9
by: john smile | last post by:
Hi All, I want to lock 2 tables on 2 servers using TABLOCKX hint. These tables function as semaphores in my application. It means when the tables are locked then other users will not be able to...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
7
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
0
by: Rajesh Kumar | last post by:
Hi Gregory Thanks for your answer. I did not see any attached file so I copied your text into a text file and named it compiler.bat Checked the wrapped lines and runned the file. It said Dataset,...
0
by: Rajesh Madhra | last post by:
Hi Gregory Thanks for your answer. I did not see any attached file so I copied your text into a text file and named it compiler.bat Checked the wrapped lines and runned the file. It said Dataset,...
5
by: Jason | last post by:
Hi all I get the following error when executing a rather intense stored procedure from an ASPX page. I have tried: - Increasing timeouts on IIS 5.0 (all areas that even mention timeout) - use...
2
by: Chris Langston | last post by:
I have a Web Server running IIS 5 or 6 on Windows 2K and Windows 2003 Server that is experiencing strange shutdown problems. We are using ASP.NET v1.1 and our application is written in VB.NET ...
17
by: Terry Olsen | last post by:
Given that variable dt = "3/31/2007", why does it produce the following exception on some machines? It works fine on my PC, but others have sent me this exception information because it threw up on...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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...
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
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...

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.