Ask a Question related to ASP Database, Design and Development.
-
Luis #1
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
-
Not ALL file information with the Shell.Application object in ASP
The code below works fine on several Windows (2003/XP) IIS servers and shows all available file information of the images folder below the currect... -
Php includes? An html file?
Hi all, I'm working on table that has to be updated quarterly by a client using either Contribute or DW. The table rotates each week and I have... -
Application Object
How easy is it for a hacker to access data stored in the Application Object in IIS server. I want to store a decrpyted connection string there rather... -
Problem occurs when included file includes anther file.
The directory structure is as follows: / |-- demo.php |-- inc/ |-- inc1.php |-- inc2.php === file demo.php == <?php require 'inc/inc1.php'; -
[PHP] Problem occurs when included file includes anther file.
Thank you for your reply first. Yes I know I could set include_path either in the php.ini or at runtime.But it's a little bit dirty I think.What... -
Jeff Cochran #2
Re: application object vs includes file
On Fri, 13 Aug 2004 04:21:48 -0700, Luis <andyzaNOSPAM@webmail.co.za>
wrote:
Absolutely.>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?
Depends on your individual site/application/needs>Which is the better method?
See answer to the above question.>Does one have a performance advantage over the other?
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



Reply With Quote

