Can I open a database connection in my GLOBAL.ASA file?

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Can I open a database connection in my GLOBAL.ASA file?

    Can I use my GLOBAL.ASA file to open a database connection before each page
    loads? Would someone mind posting a very simple example? I tried to make
    it work but couldn't. Thanks!


    michaaal Guest

  2. Similar Questions and Discussions

    1. global security - with NO internet connection?
      just upgraded my machine that has no internet connection to flash 8- I double clicked on my tried and true .swf file, developed in 7.2 - and it...
    2. DB Connection :: Global.use vs .Inc file?
      I am adapting a login script to suite my specific purposes by require guideance on best practice with regards the following: Should I be...
    3. Open file, make changes, save file, close, re-open, file contents not changed
      I've now run into this several times and it's completely destroyed all of my confidence in Ilustrator CS on Mac. I'm hoping someone can confirm that...
    4. Global.asa and DSN-less database connections
      OBJECTIVE: I am trying to create a connection to an access database in and then use that connection ASP pages in my application without having to...
    5. Can I use database commands in my Global.ASA file?
      Can I use database commands in my Global.ASA file like this...? Sub Session_OnStart Public adoCon Dim recset Set adoCon =...
  3. #2

    Default Re: Can I open a database connection in my GLOBAL.ASA file?

    You can, But NEVER do that.

    Acquire resources late and release early.

    Bu opening a connection and making every pages to reuse it
    you are creating a bottlenect by forcing your pages to use the same
    connection.
    and you will not get the benefit of connection pooling.

    Open the connection only when you need a DB access and close it immediately.



    --
    Roji. P. Thomas
    SQL Server Programmer ;)
    ________________________
    "michaaal" <res0gyio@verizon.net> wrote in message
    news:%235rUJl%23sDHA.3144@tk2msftngp13.phx.gbl...
    > Can I use my GLOBAL.ASA file to open a database connection before each
    page
    > loads? Would someone mind posting a very simple example? I tried to make
    > it work but couldn't. Thanks!
    >
    >

    Roji. P. Thomas Guest

  4. #3

    Default Re: Can I open a database connection in my GLOBAL.ASA file?

    On Wed, 26 Nov 2003 00:55:38 -0600, "michaaal" <res0gyio@verizon.net>
    wrote:
    >Can I use my GLOBAL.ASA file to open a database connection before each page
    >loads?
    Sure. And *every* page would open it, even if it didn't need a
    database connection. You could really bog down a decent site that
    way. :)

    Open a connection when needed, close and destroy the object as soon as
    you're through with it. In fact, you can go further and use an
    IF/THEN to only open the connection if there's a reason on the page.
    I see a lot of pages open a connection, then test the data returend
    from a query string only to find they reject the request. The
    connection gets opened but never used.

    Jeff
    Jeff Cochran Guest

  5. #4

    Default Re: Can I open a database connection in my GLOBAL.ASA file?

    > Can I use my GLOBAL.ASA file to open a database connection before each
    page
    > loads?
    No. You could open a connection object that stays open for the life of the
    session (and often session.timeout minutes afterward), but this is very
    wasteful and inefficient. See [url]http://www.aspfaq.com/2053[/url] for reasons.

    --
    Aaron Bertrand
    SQL Server MVP
    [url]http://www.aspfaq.com/[/url]


    Aaron Bertrand [MVP] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139