Results 1 to 8 of 8

Thread: Performance question

  1. #1

    Thread Starter
    Hyperactive Member maxl's Avatar
    Join Date
    Jan 2002
    Location
    Montréal
    Posts
    384

    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
    COBOL sa suce !!!

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    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

    BOFH Now, BOFH Past, Information on duplicates

    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...

  3. #3
    Fanatic Member RSINGH's Avatar
    Join Date
    May 2001
    Location
    London
    Posts
    522
    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.

  4. #4
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    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.

  5. #5
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188
    i think what he means is decalring it in a module i.e

    Public cn AS BLAH BLAH

    B

  6. #6
    Fanatic Member Mr.No's Avatar
    Join Date
    Sep 2002
    Location
    Mauritius
    Posts
    651
    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 ...

  7. #7
    Fanatic Member BillBoeBaggins's Avatar
    Join Date
    Jan 2003
    Location
    in your database, dropping your tables.
    Posts
    628
    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.

  8. #8
    Hyperactive Member csar's Avatar
    Join Date
    Mar 2002
    Location
    Siam
    Posts
    288
    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
  •  



Click Here to Expand Forum to Full Width