Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connections to SQL from VB - What's best practice

Status
Not open for further replies.

sandra64

Programmer
Jun 26, 2002
28
GB
Hi all,

Just a question regarding connections to a SQL database. I've always been told to open a connection, do what you have to do and then close the connection.

However, a colleague of mine recently went on a course for VB and when she explained that we will be having a large number of users (200) he said both ways (i.e. opening and closing or opening for the duration of the time they are in the application and then closing) will both have their drawbacks.

I was just wondering if any of you have large numbers of users and what practice have you used and is it okay?

Any info will be of help
cheers
Sandra
 
It depends on the type of application you're writing and the environment it will run in.

A web or COM+ application should open their connection as needed, and close it immediately afterwards.

A desktop application with a good network connection can open a connection and leave it open for an extended period of time (but you should probably put code in to handle when someone kicks the cord out of the wall).

Chip H.
 
You may also need to consider your SQL license situation if you use concurrent user licensing

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
I suggest u used SQL as your database, it could handle a lot of users.Just be sure to use Stored Procedure for speed.
We used SQL for a long time and were satisfied we the result.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top