J
Janette
Hi,
Can anyone tell me, if you were to open a connection to a database at the
top of each ASP page in a website, for example like this
<%
dim dbconn
set dbconn=server.createobject("ADODB.connection")
dbconn.ConnectionString= "File name=c:\databaseconnection.udl"
on error resume next
dbconn.open
if err.number <> 0 then
log_errs "Can Not Connect to database",""
Response.Redirect whome & "/closed.asp"
end if
on error goto 0
%>
use the connection, but never close the connection at the end of the page,
what will happen? Ie, how long will the database connection stay open? Is
the connection to the DB automatically closed when you leave the page, or
does it leave the connection open but idle, and therefore up to the
individual DB to eventually timeout and reuse the connection? Does it
potentially cause a memory leak, because you end up with lots of unused
connection and recordset objects that are no longer in use? Would it cause
sleeping sessions in a SQL Server database?
I realise it is preferable always to close connections and recordsets and
set them = to nothing when you have finished with them. But I really need to
know what the implications are if this doesn't happen.
Thanks in advance.
Janette
Can anyone tell me, if you were to open a connection to a database at the
top of each ASP page in a website, for example like this
<%
dim dbconn
set dbconn=server.createobject("ADODB.connection")
dbconn.ConnectionString= "File name=c:\databaseconnection.udl"
on error resume next
dbconn.open
if err.number <> 0 then
log_errs "Can Not Connect to database",""
Response.Redirect whome & "/closed.asp"
end if
on error goto 0
%>
use the connection, but never close the connection at the end of the page,
what will happen? Ie, how long will the database connection stay open? Is
the connection to the DB automatically closed when you leave the page, or
does it leave the connection open but idle, and therefore up to the
individual DB to eventually timeout and reuse the connection? Does it
potentially cause a memory leak, because you end up with lots of unused
connection and recordset objects that are no longer in use? Would it cause
sleeping sessions in a SQL Server database?
I realise it is preferable always to close connections and recordsets and
set them = to nothing when you have finished with them. But I really need to
know what the implications are if this doesn't happen.
Thanks in advance.
Janette