Professional Web Applications Themes

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

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

  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. #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" <res0gyioverizon.net> wrote in message
    news:%235rUJl%23sDHA.3144tk2msftngp13.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

  3. #3

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

    On Wed, 26 Nov 2003 00:55:38 -0600, "michaaal" <res0gyioverizon.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

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

Similar Threads

  1. global security - with NO internet connection?
    By ferdinand berfel in forum Macromedia Flash Player
    Replies: 0
    Last Post: June 6th, 04:31 PM
  2. Replies: 1
    Last Post: July 31st, 08:08 PM
  3. Open file, make changes, save file, close, re-open, file contents not changed
    By brock@bergdesign.com in forum Adobe Illustrator Macintosh
    Replies: 7
    Last Post: March 7th, 07:29 PM
  4. Global.asa and DSN-less database connections
    By David Raskino in forum ASP Database
    Replies: 3
    Last Post: January 22nd, 04:02 PM
  5. Can I use database commands in my Global.ASA file?
    By michaaal in forum ASP Database
    Replies: 3
    Last Post: January 2nd, 11:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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