Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Connections and ASP...

Status
Not open for further replies.

BazR

Programmer
Joined
May 28, 2003
Messages
9
Location
GB
What is the preferred method of ADO connection creation?

Should the ADO connection be created within Global.asa file, and stored in application object, for everyone to use, or should connection be created and close, each instance it is required?
 
In order to use connection pooling (the most efficient approach), I store my connection string in an application variable (created in the global.asa application_onStart). Then create, open, and close the connection on each page as needed.

set objConn = server.createObject("adodb.connection")
objConn.open(application("connStr"))
set rs = objConn.execute("select fieldName from TableName")
objConn.close
set objConn = nothing

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Ok thanks, had been storing the ADO Connection object in the Application object, upon application_onStart, but have read that this is not best.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top