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 given time. For efficiency, I
would like to keep connections alive throughout the lifetime of the objects
requiring them, rather than opening a new connection, executing code and
then closing it again. What is the most efficient way of doing this?
Should I perform the open/close or just one open when I create the object
and a close when I dispose of it? 1 2815
Robin Tucker (r.******@therm oteknix.com) writes: 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 given time. For efficiency, I would like to keep connections alive throughout the lifetime of the objects requiring them, rather than opening a new connection, executing code and then closing it again. What is the most efficient way of doing this? Should I perform the open/close or just one open when I create the object and a close when I dispose of it?
First of all, what client library are you using?
Some client libraries, ADO and ADO.Net employs connection pooling, so
when you officially disconnects, the client library actually keeps the
connection around for some 60 seconds, in case you like to reuse it.
Connection pooling can be quite essential in web applications.
If you are writing a VB application and you know you will never have
any users connected, I don't see anything wrong in creating a connection
and keep the connection object alive as a global variable.
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jeremy Ames |
last post by:
I have a problem with one of connections using the wrong connection string.
I have a form that has three late bound sql connections. Each connection is
local to the function that it used in. The problem I am having is that the
last connection uses a different username and password to sign in. By the
time that the third connection is opened, the other two connections have
been opened, closed, and disposed. What is happening is that the third...
|
by: Jeremy Ames |
last post by:
Can someone please help with this?
Unfortunately, that did not work.
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
wrote in message news:uwMY%23fquDHA.2308@TK2MSFTNGP11.phx.gbl...
Hi Jeremy,
Please try using 127.0.0.1 instead of (local) in the connection string:
cnTask.ConnectionString="Data Source=127.0.0.1;" +
|
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
|
by: ra294 |
last post by:
I have an ASP.net application using SQL Server 2000 that every once in a
while I am getting this error:
"System.InvalidOperationException: 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 looked at my code and It seems that I do close every connection that I
open so I don't know why I am getting...
|
by: |
last post by:
I was just wondering what other people's opinions and experiences were in
regards to using Database Connections throughout a website. Supposing that a
single webpage accesses a database anywhere from 5-30 times throughout a
webpage do you prefer to open the database connection upon say
initialization and reuse it elsewhere whenever possible and then dispose of
it upon disposing or do you write 5 - 10 lines of code opening and closing
it...
| |
by: Nick Gilbert |
last post by:
Hi,
I have an asp.net application which runs from a CD-ROM using Cassini. As
such, it is single user only.
The application connects to an Access database when it is loaded, and
keeps the same connection open all the time (as it's single user, this
shouldn't be a problem).
There is logic in the code to ensure that the connection is
|
by: Peter Proost |
last post by:
Hi Group,
I've got an interesting problem, I don't know if this is the right group but
I think so because everything I've read about it so far says it's a .net
problem. Here's the problem, we're using crystal reports 9 and vb.net and
we're using the crystalrepotViewer to show our reports. But every time we
open a report the connection to or sql server remains, so if I open 5 forms
with the report viewer I've got 5 sleeping connections in...
|
by: shamirza |
last post by:
ADO.Net
Making the Connection: Accessing Your Database using ADO.NET
Data Access Namespaces
Within the .NET framework class library (FCL) version 1.1, there are
five third-level namespaces that provide access to an underlying
database. These are System.Data.SqlClient, System.Data.SqlServerCE,
System.Data.OracleClient, System.Data.OleDb, and System.Data.Odbc. As
their names imply, these are used to connect to MS SQL Server, MS SQL
Server...
|
by: Usman Jamil |
last post by:
Hi
I've a class that creates a connection to a database, gets and loop on a
dataset given a query and then close the connection. When I use netstat
viewer to see if there is any connection open left, I always see that there
are 2 connections open and in "ESTABLISHED" state. Here is the piece of code
that I'm using, please tell where I'm doing it wrong. Since this class is
being used at many placed in my actual web based application that...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |