|
-
Oct 8th, 2002, 09:35 AM
#1
Thread Starter
Hyperactive Member
Performance question
I am using ADO and SQL server 2000 and I was wondering, is it better to open a global connection and then use that one when needed or to create and open a connection locally just when needed(this is what i am doing now). Thanks
-
Oct 8th, 2002, 09:37 AM
#2
Your preference and probably depends on how much data retrieval/editting will be going on.
If you have time do both methods and ask the network operators to monitor for you (plus your own timings).
Vince
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
-
Oct 8th, 2002, 11:48 AM
#3
Fanatic Member
For interactive systems where you are reading/writing data at regular intervals, then I would have one global connection left open throughout the apps 'life'. I think one connection can handle 255 recordsets. This will save time having to create/open/close/destroy connections at a local level.
The liver is bad. It must be punished.
-
Oct 8th, 2002, 12:49 PM
#4
Frenzied Member
Does this include/involve ASP (VBScript)? How does one create a global connection?
Thanks
Michael
I'm off to GalahTech, hope to see you there.
If you don't like the rules they make, refuse to play their game. -- Steve Ignorant.
-
Oct 8th, 2002, 07:18 PM
#5
PowerPoster
i think what he means is decalring it in a module i.e
Public cn AS BLAH BLAH
B
-
Oct 9th, 2002, 02:44 AM
#6
Fanatic Member
I think its better to open a connection, read data and close connection immidiately. The OLEDB provider will cache the connection if you reconnect immidiately so there'e no overhead in authentication if you're using the same connection string. You can have your connectstring as global and then create/destroy your connections locally.
It would be better if you introduced some kind of public methods such as GetData, ExecuteSQL to execute all database operations.
Using VB.NET 2003/.NET 1.1/C# 2.0
http://del.icio.us/rajoo
Blow your mind, smoke gunpowder
Ashes to ashes, dust to dust
If God won't have you, the devil will. - Author unknown
Don't follow me, I'm lost too ...
-
Jan 31st, 2003, 06:35 PM
#7
Fanatic Member
Regarding ASP (VBSCRIPT) if you want a global connection object throughout your 'site' then declare it in the Global.asa file.
TIP:
If you screw up your code in Global.asa and run it, it will not fix itself until you either reboot or stop your Web services and restart them. Good Luck!
Global connections are a good idea. You can always close them and re open them if you don't want to keep a constant connection.
-
Feb 1st, 2003, 09:27 PM
#8
Hyperactive Member
It may be good idea to declare global connection variables, but it's bad idea to make them 'live' through app. (I mean the app that be used by more than few user, if stand alone app it may OK)
Don't leave it till tomorrow, Do It Now!
5361726176757468204368616E63686F747361746869656E

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|