Which is the better method? Does one have a performance advantage over the other? *** Sent via Developersdex [url]http://www.developersdex.com[/url] *** Don't just participate in USENET...get rewarded for it! [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <#5xf6eSgEHA.3612@TK2MSFTNGP12.phx.gbl> [ref] => [htmlstate] => on_nl2br [postusername] => Luis [ip] => andyzaNOSPAM@we [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 1 [islastshown] => [isfirstshown] => 1 [attachments] => [allattachments] => ) --> application object vs includes file - ASP Database
Professional Web Applications Themes

application object vs includes file - ASP Database

Is it better to : - use an application object to store my database connection string or - use an include file on each asp page that needs to connect to the database? Example: Using the application object I could use the following in my global.asa file: <SCRIPT LANGUAGE=VBScript RUNAT=Server> SUB Application_OnStart Application("ConnString") = "PROVIDER=myprovider; DATA SOURCE=myserver; USER ID=myid; PASSWORD=mypass" Application("Server_Name") = "http://mydev/mysystemname/" END SUB SUB Application_OnEnd END SUB SUB Session_OnStart startPage = "login.asp" Session.Timeout = 15 END SUB </SCRIPT> Then I just add: Set conn = Server.CreateObject("ADODB.Connection") conn.Open Application("connstring") to each of the asp pages that need to connect ...

  1. #1

    Default application object vs includes file


    Is it better to :
    - use an application object to store my database connection string or
    - use an include file on each asp page that needs to connect to the
    database?

    Example:

    Using the application object I could use the following in my global.asa
    file:

    <SCRIPT LANGUAGE=VBScript RUNAT=Server>
    SUB Application_OnStart
    Application("ConnString") = "PROVIDER=myprovider; DATA SOURCE=myserver;
    USER ID=myid; PASSWORD=mypass"
    Application("Server_Name") = "http://mydev/mysystemname/"
    END SUB

    SUB Application_OnEnd
    END SUB

    SUB Session_OnStart
    startPage = "login.asp"
    Session.Timeout = 15
    END SUB
    </SCRIPT>

    Then I just add:
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open Application("connstring")
    to each of the asp pages that need to connect to the database.


    Alternatively, when using an includes file (eg. dbConnect.inc) I would
    put the following in the .inc file:

    Dim connStr, conn
    connStr = "PROVIDER=myprovider; DATA SOURCE=myserver; USER ID=myid;
    PASSWORD=mypass"
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Mode = 3
    conn.Open connStr

    And then include the dbConnect.inc file in each of my pages that need to
    connect to the database this way:

    <!-- #INCLUDE file = "dbConnect.inc" -->


    Which is the better method?
    Does one have a performance advantage over the other?


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Luis Guest

  2. #2

    Default Re: application object vs includes file

    On Fri, 13 Aug 2004 04:21:48 -0700, Luis <andyzaNOSPAMwebmail.co.za>
    wrote:
    >Is it better to :
    > - use an application object to store my database connection string or
    > - use an include file on each asp page that needs to connect to the
    >database?
    Absolutely.
    >Which is the better method?
    Depends on your individual site/application/needs
    >Does one have a performance advantage over the other?
    See answer to the above question.

    Google the groups for many discussions on this. There are pros and
    cons on both, and the only place it can be determined is on your
    specific system for your specific application in your specific
    environment.

    Jeff
    Jeff Cochran Guest

Similar Threads

  1. Replies: 0
    Last Post: October 9th, 07:36 PM
  2. Php includes? An html file?
    By Jefferis NoSpamme in forum Macromedia Dynamic HTML
    Replies: 2
    Last Post: December 23rd, 03:26 AM
  3. Application Object
    By Mike in forum ASP.NET Security
    Replies: 2
    Last Post: April 20th, 06:11 PM
  4. Problem occurs when included file includes anther file.
    By Caiyongzhou in forum PHP Development
    Replies: 3
    Last Post: August 8th, 08:37 AM
  5. Replies: 0
    Last Post: August 8th, 07:06 AM

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