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

Keep an ADO Connection open


I created a web method to insert data on a DB2 database.

It runs well, except every time I call it, it opens and closes the ADO
connection.

I think it would run faster, since I send it hundreds of records, if I
could just keep a connection open at the point the web service starts up
and close it when the web service is shut down ( so I would open it in
the Application_Start and close it in the Application_End ).

Could that be done? Or should I make the ADO Connection object a
static global in the web service?

Could I make all the web service inserts run on that Connection?

Would it be thread-safe if I called the web method asynchronously?

Nov 23 '05 #1
8 4094
"ja*****@texeme.com" <ja*****@texeme.com> wrote in news:95WdnVFp9rlv1VnfRVn-
sA@speakeasy.net:
Could that be done? Or should I make the ADO Connection object a
Why not just use connection pooling? Surely ADO supports that.
static global in the web service?


You will have to protect access to it, and then under load you will have performance problems as
all requests will be sharing a single connectino.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 23 '05 #2
"ja*****@texeme.com" <ja*****@texeme.com> wrote in news:95WdnVFp9rlv1VnfRVn-
sA@speakeasy.net:
Could that be done? Or should I make the ADO Connection object a
Why not just use connection pooling? Surely ADO supports that.
static global in the web service?


You will have to protect access to it, and then under load you will have performance problems as
all requests will be sharing a single connectino.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 23 '05 #3
On Thu, 30 Jun 2005 12:33:07 -0700, "ja*****@texeme.com" <ja*****@texeme.com> wrote:

¤
¤ I created a web method to insert data on a DB2 database.
¤
¤ It runs well, except every time I call it, it opens and closes the ADO
¤ connection.
¤
¤ I think it would run faster, since I send it hundreds of records, if I
¤ could just keep a connection open at the point the web service starts up
¤ and close it when the web service is shut down ( so I would open it in
¤ the Application_Start and close it in the Application_End ).
¤
¤ Could that be done? Or should I make the ADO Connection object a
¤ static global in the web service?
¤
¤ Could I make all the web service inserts run on that Connection?
¤
¤ Would it be thread-safe if I called the web method asynchronously?

This is too much trouble and I wouldn't bother. Connection pooling is enabled by default so if your
DB2 provider or driver supports connection pooling it would probably be a waste of database
resources to maintain persistent connections.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 23 '05 #4
On Thu, 30 Jun 2005 12:33:07 -0700, "ja*****@texeme.com" <ja*****@texeme.com> wrote:

¤
¤ I created a web method to insert data on a DB2 database.
¤
¤ It runs well, except every time I call it, it opens and closes the ADO
¤ connection.
¤
¤ I think it would run faster, since I send it hundreds of records, if I
¤ could just keep a connection open at the point the web service starts up
¤ and close it when the web service is shut down ( so I would open it in
¤ the Application_Start and close it in the Application_End ).
¤
¤ Could that be done? Or should I make the ADO Connection object a
¤ static global in the web service?
¤
¤ Could I make all the web service inserts run on that Connection?
¤
¤ Would it be thread-safe if I called the web method asynchronously?

This is too much trouble and I wouldn't bother. Connection pooling is enabled by default so if your
DB2 provider or driver supports connection pooling it would probably be a waste of database
resources to maintain persistent connections.
Paul
~~~~
Microsoft MVP (Visual Basic)
Nov 23 '05 #5
Paul Clement wrote:

ould it be thread-safe if I called the web method asynchronously?

This is too much trouble and I wouldn't bother. Connection pooling is
enabled by default so if your DB2 provider or driver supports connection
pooling it would probably be a waste of database resources to maintain
persistent connections.


Research shows that it supports it by default -- so, agreed, it's not
necessary.

--
Texeme Textcasting Technology
http://www.texeme.com
Nov 23 '05 #6
Paul Clement wrote:

ould it be thread-safe if I called the web method asynchronously?

This is too much trouble and I wouldn't bother. Connection pooling is
enabled by default so if your DB2 provider or driver supports connection
pooling it would probably be a waste of database resources to maintain
persistent connections.


Research shows that it supports it by default -- so, agreed, it's not
necessary.

--
Texeme Textcasting Technology
http://www.texeme.com
Nov 23 '05 #7
Chad Z. Hower aka Kudzu wrote:
Why not just use connection pooling? Surely ADO supports that.


Yes, you're correct, it looks like it's enabled by default.

--
Texeme Textcasting Technology
http://www.texeme.com
Nov 23 '05 #8
Chad Z. Hower aka Kudzu wrote:
Why not just use connection pooling? Surely ADO supports that.


Yes, you're correct, it looks like it's enabled by default.

--
Texeme Textcasting Technology
http://www.texeme.com
Nov 23 '05 #9

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

Similar topics

1
by: Robin Tucker | last post by:
Just a quick question about connection management. My application will never need more than 1 or 2 connections about at any given time. Also, I do not expect many users to be connected at any...
1
by: Jim Mitchell | last post by:
I store my connect string in the viewstate and open and close the SQL database in every function or sub-routine call. Is there a better method of opening the database when the ASPX page opens and...
4
by: jabailo | last post by:
I created a web method to insert data on a DB2 database. It runs well, except every time I call it, it opens and closes the ADO connection. I think it would run faster, since I send it...
13
by: Larry | last post by:
Hi I have asp.net programs. I used a very simple data transfer method by using URLs ˇ°First.aspxˇ± contents a line to send data to the ˇ°second.aspxˇ± page, for
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
3
by: Paul | last post by:
Hello, First I want to refer to the problem "WebRequest : execute a button" of a few days ago. The way I solved it, I loose my session, and as a consequence my session variables. I don't want...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
6
by: TheSteph | last post by:
Hi, (using C#, VS2005, .NET 2.0.) I sometimes need to access my database (SQL Server) in SINGLE_USER mode.
5
by: vieraci | last post by:
Hi, I'm wanting to start a database connection at the start of an app and keep it open for all methods and classes that I'm #including in my project. First I went about it by creating the...
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
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: 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: 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
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.