Hi,
(using C#, VS2005, .NET 2.0.)
I sometimes need to access my database (SQL Server) in SINGLE_USER mode.
That works fine but after a few minutes the connection pooling seems to
automatically free the connection to the server, and doing so other computer
can connect to the database and "steal the Single User session".
Here is my question : How can I force connection pooling to keep at least
one connection open ? (that will prevent other computer to "steal" the
single user session)
Thanks for your help !
Steph. 6 4030
Connection pooling works based on a unique connection string, each one
defining a pool. So in this case, you would simply use a different connection
string with "pooling=of f" in it.
--Peter
"Inside every large program, there is a small program trying to get out." http://www.eggheadcafe.com http://petesbloggerama.blogspot.com http://www.blogmetafinder.com
"TheSteph" wrote:
Hi,
(using C#, VS2005, .NET 2.0.)
I sometimes need to access my database (SQL Server) in SINGLE_USER mode.
That works fine but after a few minutes the connection pooling seems to
automatically free the connection to the server, and doing so other computer
can connect to the database and "steal the Single User session".
Here is my question : How can I force connection pooling to keep at least
one connection open ? (that will prevent other computer to "steal" the
single user session)
Thanks for your help !
Steph.
In this scenario, that might make the problem worse; as soon as the
code closes the connection (assuming standard "open, use, close"
pattern of data-access) the /actual/ connection would be closed and
the database would be open. At least at the moment the connection is
held long enough to prevent other computers stealing access.
Of course, the better approach is to not relinqish the connection
until you are done with it, but that could require changes, especially
if the code is designed to use the "open, use, close" pattern at all
other times.
Marc
Thank-you for the helpfull link !
To use " load balance timeout" I have to give a time in minute... and it
work only with "clustered pooling" (I don't know what it is by the way...)
Instead you gave me the idea to use the "Min Pool Size=1" option; since I
use the same connection string for everything in my application I think that
this way at least one connection will remain in the pool until the
application is closed.
I tested it and it seems to work fine : In Single_User mode I do not loose
my session on the server anymore so others users cannot steal it...
Thanks !
Steph.
"Marc Gravell" <ma**********@g mail.comwrote in message
news:up******** ******@TK2MSFTN GP02.phx.gbl...
I haven't tested it, but you could try setting a load balance timeout
in the connection string?
http://msdn2.microsoft.com/en-us/lib...ng(VS.80).aspx
>
Marc
"TheSteph" <Th******@NoSpa m.comwrote in message
news:uU******** ******@TK2MSFTN GP06.phx.gbl...
Thank-you for the helpfull link !
To use " load balance timeout" I have to give a time in minute... and it
work only with "clustered pooling" (I don't know what it is by the
way...)
Instead you gave me the idea to use the "Min Pool Size=1" option; since I
use the same connection string for everything in my application I think
that
this way at least one connection will remain in the pool until the
application is closed.
I tested it and it seems to work fine : In Single_User mode I do not loose
my session on the server anymore so others users cannot steal it...
Keep in mind that doing this will keep a client connected to the DB Server
for as long as the application is running, if you have many clients like
these, you'll exhaust the max. number of licensed connection with the DB
server for no good reason, more you are preventing other users to connect
even when you don't effectively need the connection.
Willy.
Yes, It was a problem...
But I solved it by doing the change in the connection string programatically
(add "Min Pool Size=1") only on the computer that enable the Single_User
mode. I then make a call to SqlConnection.C learAllPool(), and open/close a
SqlConnection with the new connection string, and the pool will keep 1
connection only ont this computer. A check is also made at application
stratup. and a Reverse operation is made when user go back to MULTIUSER
mode.
Until now it seems to work perfectly....
Thank for your advices !
steph.
"Willy Denoyette [MVP]" <wi************ *@telenet.bewro te in message
news:e3******** ******@TK2MSFTN GP05.phx.gbl...
"TheSteph" <Th******@NoSpa m.comwrote in message
news:uU******** ******@TK2MSFTN GP06.phx.gbl...
Thank-you for the helpfull link !
To use " load balance timeout" I have to give a time in minute... and
it
work only with "clustered pooling" (I don't know what it is by the
way...)
Instead you gave me the idea to use the "Min Pool Size=1" option; since
I
use the same connection string for everything in my application I think
that
this way at least one connection will remain in the pool until the
application is closed.
I tested it and it seems to work fine : In Single_User mode I do not
loose
my session on the server anymore so others users cannot steal it...
Keep in mind that doing this will keep a client connected to the DB Server
for as long as the application is running, if you have many clients like
these, you'll exhaust the max. number of licensed connection with the DB
server for no good reason, more you are preventing other users to connect
even when you don't effectively need the connection.
Willy.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: John |
last post by:
Hi
I am trying to use the internet transfer control to send some data to a
site. I want my MS ISA proxy server to keep the connection alive. What
syntax should I use to send the 'keep alive' data to the proxy server? Is
any of the following any good?
objInet.Execute "http://wwww.mysite.com", "POST", "Some Data",
"Content-Type: application/x-www-form-urlencoded Proxy-Connection:
Keep-Alive" & vbCrLf
|
by: Jonas Knaus |
last post by:
hello
until now i allways wrote all my sql-stuff in my presentation-layer.
i heard about that model of that presentation- / businesslogic- and data
access layer -model.
i found some example on the internet, but not very useful.
does anyone has some examples for this ???
i would by very happy !!!
|
by: Rob Nicholson |
last post by:
We're getting an occasional occurrence of the following error when two users
try and open the same record in our ASP.NET app:
"There is already an open DataReader associated with this Connection which
must be closed first."
As suggested, I was closing the connection in the Finally part of the outer
Try but I wasn't closing the data reader as well so I assume that if the
following happens, the above error could occur
|
by: Nuno Magalhaes |
last post by:
With the sniffer ethereal I get a lot of Connections Keep Alive in some
sites like google.com and that returns me the Content-Length in the
HTTP response header.
When the connection is Close I don't get the Content-Length but I get
an hexadecimal number that represents the size of the page but that is
after the header and in the page more precisely.
Is this normal to have this behaviour? I don't know how IE does to get
Connections...
|
by: Martin B |
last post by:
Hallo!
I'm working with C# .NET 2.0, implementing Client/Server Applications which
are connecting via Network to SQL-Server or Oracle Databases.
To stay independent from the underlaying Database I use
System.Data.Common.DBConnection and .DBCommand.
How can I keep aware from connection losses (network not availeable,
db-server not available...)?
Are there any strategies to detect this broken connections, and how can I
| |
by: Steven Blair |
last post by:
As I understand it, if I create a connection object in my application
and close the connection, the next time I open a connection with the
same connection string I should be using a pooled connection?
Is this possible over different instances of a class.
For example
Instance 1 of my dll is alive and creates a connection to a Database.
The class goes out of scope (I have closed the connection by this stage)
|
by: Ike |
last post by:
Is anyone aware of a means of connection pooling (to MySQL, say) in php?
Thanks, Ike
|
by: Joanna Carter [TeamB] |
last post by:
Hi Folks
I am just trying to get my head around whether I can use a single
SQLConnection for the life of the application or whether I should create it
only when needed.
I want to create cached SQLCommand objects that are then prepared to reduce
subsequent execution time, but these can't be prepared unless their
Connection property has been set.
|
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 g_sConnectionString and leave this connection
open and not close it until it exits the application.
Then on each thread/each subsequent sub that needs the connection I create a
local OleDBConnection variable, open the connection using the exact...
|
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: 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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |