I never use the global.asa for database connections. Instead I create a configuration include with seperate database logins. This way I can close the connections right after I pull my data and never have a problem. If your using and access or SQL database this will work. By creating a configuration include I can also use the same file for setting other parameters in my application by using a Virtual connection. I use mostly DSNLess connections and here's a sample.
<%
'---------------Create Common Data Path ---------------------------------------------
Dim DSNless
'Rem this is a DSNless connection for an access db
'
DSNless = "DRIVER={Microsoft Access Driver (*.mdb)};UID=(my user id);PWD=(my password);DBQ=(my hard path to database)D:\website\db\"
'
'------------- Connect to Database one------------------------------------------
'
Function OpenDB1 (ByRef Cn) 'Cn is the reference I pass to the function call
DSN = DSNless & "Database1.mdb"
Set Cn = Server.CreateObject("ADODB.Connection"
With Cn
.ConnectionString = DSN
.ConnectionTimeout = 15
.Open
End With
End Function
'
'------------- Connect to Database 2 ------------------------------------------
'
Function OpenDB2 (ByRef Cn)
DSN = DSNless & "Database2.mdb"
Set Cn = Server.CreateObject("ADODB.Connection"
With Cn
.ConnectionString = DSN
.ConnectionTimeout = 15
.Open
End With
End Function
'
'---- Repair Quotation Marks -----------------------------------------------------------
'
FUNCTION fixQuotes( theString )
fixQuotes = Replace( theString, "'", "''" )
END FUNCTION
%>
Remember though that even though I use Cn in both function calls you need to reference them differently on your page. Example :
OpenDB1 Cn1
OpenDB2 Cn2
Hope this helps.