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

SQLConnection questions

I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how can
I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader, then
close it right away, but sometimes I still get the error "There is already
an open DataReader associated with this Connection which must be closed
first." What is the best way to avoid this ?

Thank you.
May 16 '07 #1
5 3409
1. The conn pool is at the .Net layer, and it is not at SQL sever layer.
2. I believe it is ~850 ( I did not close the connection at a .Net app once,
and it ran vey slow after I have over 850 call)
3. You mean you close the reader as well?

--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:Oo**************@TK2MSFTNGP05.phx.gbl...
>I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how
can I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader, then
close it right away, but sometimes I still get the error "There is already
an open DataReader associated with this Connection which must be closed
first." What is the best way to avoid this ?

Thank you.

May 16 '07 #2
I thought the maximum pool size is 100 ? But, I am not sure what the default
maximum pool size is.

I close the database after the reader, then close the database right away
after that. Then, when I am done with the reader, I close and dispose it,
too.
Do you declare the connection as a global variable or local variable ?

"Egghead" <robertlo@NO_SHAW.CAwrote in message
news:uY**************@TK2MSFTNGP02.phx.gbl...
1. The conn pool is at the .Net layer, and it is not at SQL sever layer.
2. I believe it is ~850 ( I did not close the connection at a .Net app
once, and it ran vey slow after I have over 850 call)
3. You mean you close the reader as well?

--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:Oo**************@TK2MSFTNGP05.phx.gbl...
>>I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how
can I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader,
then close it right away, but sometimes I still get the error "There is
already an open DataReader associated with this Connection which must be
closed first." What is the best way to avoid this ?

Thank you.


May 16 '07 #3
It does not matter
--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>I thought the maximum pool size is 100 ? But, I am not sure what the
default maximum pool size is.

I close the database after the reader, then close the database right away
after that. Then, when I am done with the reader, I close and dispose it,
too.
Do you declare the connection as a global variable or local variable ?

"Egghead" <robertlo@NO_SHAW.CAwrote in message
news:uY**************@TK2MSFTNGP02.phx.gbl...
>1. The conn pool is at the .Net layer, and it is not at SQL sever layer.
2. I believe it is ~850 ( I did not close the connection at a .Net app
once, and it ran vey slow after I have over 850 call)
3. You mean you close the reader as well?

--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:Oo**************@TK2MSFTNGP05.phx.gbl...
>>>I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how
can I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader,
then close it right away, but sometimes I still get the error "There is
already an open DataReader associated with this Connection which must be
closed first." What is the best way to avoid this ?

Thank you.



May 16 '07 #4
So, it does not matter using local or global SQLConnection variable ?
When I use a local one, on each subroutine I set the SQLConnection variable
to new, open and close the connection everytime I fill a dataset, is it
correct ?
Or, do I need to use a global SQLConnection variable
1. new and open it on form_load (and do not close this one until
form_Closed)
2. and in each subroutine use this global SQLConnection variable but new,
open and close the connection in this subroutine ?

"Egghead" <robertlo@NO_SHAW.CAwrote in message
news:eW**************@TK2MSFTNGP06.phx.gbl...
It does not matter
--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:eH**************@TK2MSFTNGP04.phx.gbl...
>>I thought the maximum pool size is 100 ? But, I am not sure what the
default maximum pool size is.

I close the database after the reader, then close the database right away
after that. Then, when I am done with the reader, I close and dispose it,
too.
Do you declare the connection as a global variable or local variable ?

"Egghead" <robertlo@NO_SHAW.CAwrote in message
news:uY**************@TK2MSFTNGP02.phx.gbl...
>>1. The conn pool is at the .Net layer, and it is not at SQL sever layer.
2. I believe it is ~850 ( I did not close the connection at a .Net app
once, and it ran vey slow after I have over 850 call)
3. You mean you close the reader as well?

--
cheers,
RL
"fniles" <fn****@pfmail.comwrote in message
news:Oo**************@TK2MSFTNGP05.phx.gbl...
I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how
can I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader,
then close it right away, but sometimes I still get the error "There is
already an open DataReader associated with this Connection which must
be closed first." What is the best way to avoid this ?

Thank you.



May 16 '07 #5
cj
I've been watching your post because I've just been through a similar
situation.

I have a multi-threaded TCP/IP Server app that needs to execute a stored
procedure as part of answering each connection\request it receives. A
thread is created to handle each connection\request and it takes less
than 2 seconds to answer the connection and the connection and thread
end. But I get so many requests the app is usually constantly handling
1 or 2 requests and I have seen 150 concurrent requests being handled.

So how do I handle making that connection the the SQL Server? Well I've
been told here and by a colleague who'd researched it before that SQL
will reuse old closed connections (basically sql sorts it all out) so I
should just Dim a new sqlconnection in each tread when it is created and
close the connection before the thread terminates. It works! That's
about all I can say. It's amazing to me that it does and that's why I'm
watching the responses here too.
fniles wrote:
I am using VB.NET 2003. When using SQLClient.SQLConnection with SQL 2005
database,
1. connection pooling is automatically used, right ? I mean, in the
connection string I do not need to explicitly write Pooling=true ?
2. What is the default Max Pool size ? After I open the connection, how can
I check what is the max pool size ?
3. I always open the db right before I fill dataset or open a reader, then
close it right away, but sometimes I still get the error "There is already
an open DataReader associated with this Connection which must be closed
first." What is the best way to avoid this ?

Thank you.

May 18 '07 #6

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

Similar topics

1
by: Donnie Darko | last post by:
I'm trying to understand SqlConnection(), SqlCommand() For example. I use SqlConnection() as a parameter when I create a new SqlCommand. Then I open SqlConnection(), then I execute the...
3
by: Cablito | last post by:
The dilema is simple: Documents tell you to paranoically close your connections as soon as you are done with them, to release resources, though I fail to see how much impact an open connection...
4
by: arran.pearce | last post by:
Hi, I am using .NET 2 (beta2) and are having problems with using a SqlConnection. I have created a test application that opens a sql connections, gets some basic data and then closes the...
11
by: Bob | last post by:
In our new .NET web applications, we try to limit the use of SqlConnection to just one instance per page, even if there are multiple accesses to various queries. The thinking behind is that this...
4
by: Steve Richter | last post by:
I really miss c++ .... I have an SqlConnection object within my Web.UI.Page object. The thinking is that the connection to the database server is opened once when the page starts to do its...
9
by: Roman | last post by:
Hello I have a component built in VB.2003. It has the following property: Public Shared mCONN As SqlConnection Public Property Connection() As SqlConnection Get Return mCONN End Get...
4
by: Victor | last post by:
Hi Guys I have a problem here. I want to improve the performance for a website. When I looked into the system, I have found that the system made the "SqlConnection Object" static. That mean only...
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: 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:
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...
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.