473,385 Members | 1,402 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.

objectdatasource sqldatareader and conection pooling

Hi,

Recently, my site has been generating errors which say:
"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."

I'm wondering if this might have something to do with the way that we use
objectdatasource objects.

In an aspx page, we would put a gridview/dataview/whatever and bind it to an
objectdatasource.

The objectdatasource pulls data from a middle tier component which often
simply returns a sqldatareader object.

We're using the Enterprise Library's Data Access Application Block to handle
some of the data access functionality, and I believe that the DAAB
automatically sets the CommandBehavior.CloseConnection propperty.

However, because we are simply returning the datareader from the middle
tier, and passing them along to the objectdatasource on the aspx page, there
is no way (that I can think of) to call datareader.close or connection.close.

So, my question is: Does an objectdatasource close the datareader (and
connection) or is this all left open until the garbage collector comes along?

And if it is left open, is there simple way around this, or should I recode
the middle-tier to return datasets (or datatables or some other object) so
that I can close the connection manually?

thanks,
Doug
Nov 10 '06 #1
3 1919
Seems clear to me that you've answered your own question. If you are getting
errors like this you can be pretty sure that those particular datareaders
aren't being closed and / or the connnections aren't being closed or Disposed.

DataSets, using a SqlDataAdapter which takes care of all this on its own, is
one good solution. There's a bit extra overhead over the straight reader but
in the big scheme of things you can find many other areas where optimization
can have much more effect - caching, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Doug Salomon" wrote:
Hi,

Recently, my site has been generating errors which say:
"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."

I'm wondering if this might have something to do with the way that we use
objectdatasource objects.

In an aspx page, we would put a gridview/dataview/whatever and bind it to an
objectdatasource.

The objectdatasource pulls data from a middle tier component which often
simply returns a sqldatareader object.

We're using the Enterprise Library's Data Access Application Block to handle
some of the data access functionality, and I believe that the DAAB
automatically sets the CommandBehavior.CloseConnection propperty.

However, because we are simply returning the datareader from the middle
tier, and passing them along to the objectdatasource on the aspx page, there
is no way (that I can think of) to call datareader.close or connection.close.

So, my question is: Does an objectdatasource close the datareader (and
connection) or is this all left open until the garbage collector comes along?

And if it is left open, is there simple way around this, or should I recode
the middle-tier to return datasets (or datatables or some other object) so
that I can close the connection manually?

thanks,
Doug
Nov 10 '06 #2
Well, I hate answering my own question. :(

Uch, this is going to be a lot of very boring work.

Well, as long as I'm going to recode this, is there any reason to use a full
dataset, or could I save bit of memory overhead and just return a datatable
object?

thanks for answering,
Doug

"Peter Bromberg [C# MVP]" wrote:
Seems clear to me that you've answered your own question. If you are getting
errors like this you can be pretty sure that those particular datareaders
aren't being closed and / or the connnections aren't being closed or Disposed.

DataSets, using a SqlDataAdapter which takes care of all this on its own, is
one good solution. There's a bit extra overhead over the straight reader but
in the big scheme of things you can find many other areas where optimization
can have much more effect - caching, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Doug Salomon" wrote:
Hi,

Recently, my site has been generating errors which say:
"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."

I'm wondering if this might have something to do with the way that we use
objectdatasource objects.

In an aspx page, we would put a gridview/dataview/whatever and bind it to an
objectdatasource.

The objectdatasource pulls data from a middle tier component which often
simply returns a sqldatareader object.

We're using the Enterprise Library's Data Access Application Block to handle
some of the data access functionality, and I believe that the DAAB
automatically sets the CommandBehavior.CloseConnection propperty.

However, because we are simply returning the datareader from the middle
tier, and passing them along to the objectdatasource on the aspx page, there
is no way (that I can think of) to call datareader.close or connection.close.

So, my question is: Does an objectdatasource close the datareader (and
connection) or is this all left open until the garbage collector comes along?

And if it is left open, is there simple way around this, or should I recode
the middle-tier to return datasets (or datatables or some other object) so
that I can close the connection manually?

thanks,
Doug
Nov 13 '06 #3

Doug Salomon wrote:
Well, I hate answering my own question. :(

Uch, this is going to be a lot of very boring work.

Well, as long as I'm going to recode this, is there any reason to use a full
dataset, or could I save bit of memory overhead and just return a datatable
object?

thanks for answering,
Doug

"Peter Bromberg [C# MVP]" wrote:
Seems clear to me that you've answered your own question. If you are getting
errors like this you can be pretty sure that those particular datareaders
aren't being closed and / or the connnections aren't being closed or Disposed.

DataSets, using a SqlDataAdapter which takes care of all this on its own, is
one good solution. There's a bit extra overhead over the straight reader but
in the big scheme of things you can find many other areas where optimization
can have much more effect - caching, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Doug Salomon" wrote:
Hi,
>
Recently, my site has been generating errors which say:
"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."
>
I'm wondering if this might have something to do with the way that we use
objectdatasource objects.
>
In an aspx page, we would put a gridview/dataview/whatever and bind it to an
objectdatasource.
>
The objectdatasource pulls data from a middle tier component which often
simply returns a sqldatareader object.
>
seems imao to be a good case to use 'ASP.NET Output Caching with SQL
Server '
(not page caching).
wawens
We're using the Enterprise Library's Data Access Application Block to handle
some of the data access functionality, and I believe that the DAAB
automatically sets the CommandBehavior.CloseConnection propperty.
>
However, because we are simply returning the datareader from the middle
tier, and passing them along to the objectdatasource on the aspx page, there
is no way (that I can think of) to call datareader.close or connection.close.
>
So, my question is: Does an objectdatasource close the datareader (and
connection) or is this all left open until the garbage collector comes along?
>
And if it is left open, is there simple way around this, or should I recode
the middle-tier to return datasets (or datatables or some other object) so
that I can close the connection manually?
>
thanks,
Doug
Nov 14 '06 #4

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

Similar topics

3
by: avezina | last post by:
We would like to use those new cool features of Asp.Net 2.0 like the ObjectDataSource in our project. I tried few basics examples and its work well. Let's say I have a page that displays a...
3
by: mthomason | last post by:
I keep getting this error when trying to update records using an ObjectDataSource. I have seen others post similar errors...but I haven't found any solutions. ObjectDataSource...
1
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this...
2
by: J055 | last post by:
Hi I've implemented caching for my ObjectDataSource. <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding" ...
0
by: avital | last post by:
Hi, Hope someone can please help. I have a Gridview with a checkboxlist. On edititemTemplate I want the checkboxlist items to be selected as returned from the database. In the database I...
1
by: Barry L. Camp | last post by:
Hi all, Wondering if someone can help with a nagging problem I am having using a GridView and an ObjectDataSource. I have a simple situation where I am trying to delete a row from a table, but...
1
by: =?Utf-8?B?cm9zczYxMw==?= | last post by:
I really hope this is not a case of "this silly thing will never work".....lots of time invested in troubleshooting this already. I have created a standard ASP.NET web form (.aspx) with several...
4
by: ajmastrean | last post by:
Folks, What are the best practices, pros/cons, performance, scalability considerations in choosing the source/type for an object's ObjectDataSource (consider a GridView that needs to display a...
5
by: ind_123 | last post by:
Can connection pooling be implemented for multiple applications? How is it done?
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: 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: 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: 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: 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...

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.