Unix Technical Forum

Connection Management

This is a discussion on Connection Management within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi: I have a Point-of-sale application that uses SQL Server2000 for the backend. Basically, the users perform various functions ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:08 PM
Ryan P. Kennedy
 
Posts: n/a
Default Connection Management

Hi:

I have a Point-of-sale application that uses SQL Server2000 for the backend.
Basically, the users perform various functions boiling down to login (check
password from a table) and data entry (insert a food entry). Previously, I
would open a new ADO 2.7 connection to the database each time one of these
types of database accessing functions needed to be performed - but I noticed
that sometimes the DB would freeze the application for 20 seconds or so - or
even cause a timeout error.

To fix this, I open a DB connection when the application first starts,
keeping it open for the life of the application - each time a function needs
to access the DB, it just uses the applications (global) connection that is
constantly open and connected.

This seems to have fixed the problem, however, I am curious, is this an OK
way to handle the connections - keeping in mind that there are four separate
stations - each running the application - at the same time. Therefore, I
have 4 constantly open connections at the same time.


Thanks and regards,

Ryan Kennedy


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:08 PM
Simon Hayes
 
Posts: n/a
Default Re: Connection Management


"Ryan P. Kennedy" <ryanp.kennedy@verizon.net> wrote in message
news:lYnBb.4549$UM4.1037@nwrdny01.gnilink.net...
> Hi:
>
> I have a Point-of-sale application that uses SQL Server2000 for the

backend.
> Basically, the users perform various functions boiling down to login

(check
> password from a table) and data entry (insert a food entry). Previously,

I
> would open a new ADO 2.7 connection to the database each time one of these
> types of database accessing functions needed to be performed - but I

noticed
> that sometimes the DB would freeze the application for 20 seconds or so -

or
> even cause a timeout error.
>
> To fix this, I open a DB connection when the application first starts,
> keeping it open for the life of the application - each time a function

needs
> to access the DB, it just uses the applications (global) connection that

is
> constantly open and connected.
>
> This seems to have fixed the problem, however, I am curious, is this an OK
> way to handle the connections - keeping in mind that there are four

separate
> stations - each running the application - at the same time. Therefore, I
> have 4 constantly open connections at the same time.
>
>
> Thanks and regards,
>
> Ryan Kennedy
>
>


I don't know much about ADO, but it sounds like you're describing a form of
connection pooling, which is certainly a very common way to manage
connections from multiple clients.

Simon


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 07:09 PM
BenignVanilla
 
Posts: n/a
Default Re: Connection Management


"Ryan P. Kennedy" <ryanp.kennedy@verizon.net> wrote in message
news:lYnBb.4549$UM4.1037@nwrdny01.gnilink.net...
> Hi:
>
> I have a Point-of-sale application that uses SQL Server2000 for the

backend.
> Basically, the users perform various functions boiling down to login

(check
> password from a table) and data entry (insert a food entry). Previously,

I
> would open a new ADO 2.7 connection to the database each time one of these
> types of database accessing functions needed to be performed - but I

noticed
> that sometimes the DB would freeze the application for 20 seconds or so -

or
> even cause a timeout error.
>
> To fix this, I open a DB connection when the application first starts,
> keeping it open for the life of the application - each time a function

needs
> to access the DB, it just uses the applications (global) connection that

is
> constantly open and connected.
>
> This seems to have fixed the problem, however, I am curious, is this an OK
> way to handle the connections - keeping in mind that there are four

separate
> stations - each running the application - at the same time. Therefore, I
> have 4 constantly open connections at the same time.


Connection pooling, the sharing of a single connection among components of
an application, is very common and a good design principle. It is
particularly great for web based/ASP applications, in order to conserve
resource. Persistant connections, keeping a connection open even when not in
use, is something I shy away from in my client server and my web based app
designs. I prefer to create a connection, pool it, and then open and close
it as needed.

It sounds like you are looking for a solution to a symptom, and not your
problem. If I were you, I would investigate the reason your app is timing
out and solve that.

--
BV.
WebPorgmaster - www.IHeartMyPond.com
Work at Home, Save the Environment - www.amothersdream.com


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:51 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com