dbTalk Databases Forums  

Open SQL 2005 database question

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Open SQL 2005 database question in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Charlie
 
Posts: n/a

Default Open SQL 2005 database question - 10-29-2007 , 05:05 PM






Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?

Thanks for any info.



Reply With Quote
  #2  
Old   
Ed Murphy
 
Posts: n/a

Default Re: Open SQL 2005 database question - 10-29-2007 , 09:44 PM






Charlie wrote:

Quote:
Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?
How often will the VB program access the database?


Reply With Quote
  #3  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Open SQL 2005 database question - 10-30-2007 , 02:18 AM



Charlie (jadkins4 (AT) yahoo (DOT) com) writes:
Quote:
Shoud a SQL 2005 database remain open in a Visual Basic program, or should
it be opened and closed in every subroutine?
You don't really open or close the database, but you connect and disconnect
from the server.

It's common to do as you say open and disconnect. It's not really cheap to
open a connection to SQL Server. However, the client API maintains a
connection pool, so behind the scenes the connection is open, and is reused
when you connect anew. (If there is no connection for a certain amount of
time, typically 60 seconds, the connection is closed for real.)

Then again, in a two-tier application it's not really any major flaw to
have a global connection that you keep open.


--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
  #4  
Old   
Charlie
 
Posts: n/a

Default Re: Open SQL 2005 database question - 10-30-2007 , 09:21 AM



Very frequently.

"Ed Murphy" <emurphy42 (AT) socal (DOT) rr.com> wrote

Quote:
Charlie wrote:

Shoud a SQL 2005 database remain open in a Visual Basic program, or
should it be opened and closed in every subroutine?

How often will the VB program access the database?



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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.