473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

keeping sql connection open

hello all....
i have one query....
can somebody please tell me advantages and disadvantages of making
connection to sql server open at the start of application and closing it at
the end of application (in windows application or web application) ?
what will be consequences ?
is it a good practice ?
please comment.
actually me and my friend is having argument on this...
he says, dot net have disconnected architecture.... so u dont need to every
time (in ur functions or subroutines where u executes different sql commands)
open or close the connection.
well, what is a good practice ?
what exactly is the meaning of disconnected architecture ?
please comment.
Nov 22 '05 #1
2 2014
An interesting comparison is between clients like Oracle Forms, which connect
for the duration and the .Net client apps which, as you say, generally take
the disconnected approach. This not only means having no persistant db
connection but also things like 'optimisistic locking' where you don't lock
the data you fetch or modify on the client. Instead you check the database at
the point you perform the update/insert/delete to see if anyone else has
changed the data while you've had it in front of you (so to speak) on the
client. Coming from a traditional 'connected' background this does take
getting used to. Something like Oracle Forms will happily stream and cache
millions of rows from a database for you, and lock those you 'touch'.

With web based applications it makes sense to disconnect after each
transaction. The thought of users spread across a network, which could be
global, running an web form application and each one having a persitent
dedicated connection is scary :)

Rob J

"lokee" wrote:
hello all....
i have one query....
can somebody please tell me advantages and disadvantages of making
connection to sql server open at the start of application and closing it at
the end of application (in windows application or web application) ?
what will be consequences ?
is it a good practice ?
please comment.
actually me and my friend is having argument on this...
he says, dot net have disconnected architecture.... so u dont need to every
time (in ur functions or subroutines where u executes different sql commands)
open or close the connection.
well, what is a good practice ?
what exactly is the meaning of disconnected architecture ?
please comment.

Nov 22 '05 #2
hi...
i'm still not satisfied with this answer...
could somebody please explain me in detail... connection pooling...
what will happen if the con.open is declared at the start of application and
con.close at the end of application and do not opening or closing the
connection during any of execution of queries within application...
what wil be effects if its a web application and what will be effects if its
a desktop application...
please help.

"RobJUK66" wrote:
An interesting comparison is between clients like Oracle Forms, which connect
for the duration and the .Net client apps which, as you say, generally take
the disconnected approach. This not only means having no persistant db
connection but also things like 'optimisistic locking' where you don't lock
the data you fetch or modify on the client. Instead you check the database at
the point you perform the update/insert/delete to see if anyone else has
changed the data while you've had it in front of you (so to speak) on the
client. Coming from a traditional 'connected' background this does take
getting used to. Something like Oracle Forms will happily stream and cache
millions of rows from a database for you, and lock those you 'touch'.

With web based applications it makes sense to disconnect after each
transaction. The thought of users spread across a network, which could be
global, running an web form application and each one having a persitent
dedicated connection is scary :)

Rob J

"lokee" wrote:
hello all....
i have one query....
can somebody please tell me advantages and disadvantages of making
connection to sql server open at the start of application and closing it at
the end of application (in windows application or web application) ?
what will be consequences ?
is it a good practice ?
please comment.
actually me and my friend is having argument on this...
he says, dot net have disconnected architecture.... so u dont need to every
time (in ur functions or subroutines where u executes different sql commands)
open or close the connection.
well, what is a good practice ?
what exactly is the meaning of disconnected architecture ?
please comment.

Nov 22 '05 #3

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

Similar topics

2
by: lokee | last post by:
hello all.... i have one query.... can somebody please tell me advantages and disadvantages of making connection to sql server open at the start of application and closing it at the end of...
12
by: marcadonis | last post by:
Hi! Does anybody know of a way that I can keep a reference to an object that I can then reuse? I tried various approaches using navigator, but these all fail in an iframe due to premission...
2
by: Josef Meile | last post by:
Hi, I'm using a ComboBox, some Textboxes, and a DataGrid to represent a many-to-many relationship between Person and Course. Each time that I change the value in the ComboBox (which for now is...
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...
2
by: MrMike | last post by:
I have a web.config file containing the SQLConnection String to a SQL Database. Before I implemented this SQLConnection String into web.config, I had individual SQLConnection objects in each...
3
by: robboll | last post by:
I am building an ASP.NET data entry form and when I change the values per the dropdowns and click "save", the old values remain. Are there any suggestions on how to update the variables to the...
5
by: Edwin Knoppert | last post by:
ExecuteNonQuery requires an open and available Connection. The connection's current state is closed. Often, i mean a few times a day, the database is no longer reachable. The appication pool...
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...
3
by: fniles | last post by:
In the Windows application (using VB.NET 2005) I use connection pooling like the following: In the main form load I open a connection using a connection string that I stored in a global variable...
9
by: fniles | last post by:
I am using VB.NET 2003 and SQL 2005. To use connection pooling and avoid the error "There is already an open DataReader associated with this Connection which must be closed first." , I understand...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.