|
 |
asp_databases thread: debug error for cn var in global.asa (OLEDB connection string)
Message #1 by "Neethling, Dirk BYNI/PLM" <Dirk.Neethling2@h...> on Wed, 27 Sep 2000 13:13:12 +0200
|
|
> i'm using the following connection string in global.asa:
>
> <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> dim cnn, cn, ProvStr
>
> Sub Session_OnStart
> set cn = server.CreateObject("ADODB.Connection")
> cn.Provider = "SQLOLEDB.1"
> ProvStr = "Server=BYNIS052;Database=nbs;UID=sa;PWD=;"
> cn.Open ProvStr
> Set Session("cnn") = cn
> End Sub
>
> Sub Session_OnEnd
> cn.Close
> End sub
> </script>
>
> every 20 min. or so (the time i set in the config for session variables) i
> get a debugging message which asks for the variable 'cn'.
> what to do?
>
> dirk
Message #2 by "Dror Zeplovitch" <drorzp@i...> on Wed, 27 Sep 2000 18:55:28 +0200
|
|
you define the connection at session level define it on a page there is no
need to open a connection for such a long time
it only takes resources. use it only when you need it
----- Original Message -----
From: Neethling, Dirk BYNI/PLM <Dirk.Neethling2@h...>
To: ASP Databases <asp_databases@p...>
Sent: Wednesday, September 27, 2000 1:13 PM
Subject: [asp_databases] debug error for cn var in global.asa (OLEDB
connection string)
>
> > i'm using the following connection string in global.asa:
> >
> > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> > dim cnn, cn, ProvStr
> >
> > Sub Session_OnStart
> > set cn = server.CreateObject("ADODB.Connection")
> > cn.Provider = "SQLOLEDB.1"
> > ProvStr = "Server=BYNIS052;Database=nbs;UID=sa;PWD=;"
> > cn.Open ProvStr
> > Set Session("cnn") = cn
> > End Sub
> >
> > Sub Session_OnEnd
> > cn.Close
> > End sub
> > </script>
> >
> > every 20 min. or so (the time i set in the config for session variables)
i
> > get a debugging message which asks for the variable 'cn'.
> > what to do?
> >
> > dirk
>
Message #3 by =?iso-8859-1?Q?Jorge_Mart=EDn?= <jmartin@p...> on Wed, 27 Sep 2000 18:22:05 +0200
|
|
Try to do...
Session("cnn").Close
...in the session_onEnd routine
I'm not sure......
----- Original Message -----
From: "Neethling, Dirk BYNI/PLM" <Dirk.Neethling2@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, September 27, 2000 1:13 PM
Subject: [asp_databases] debug error for cn var in global.asa (OLEDB
connection string)
>
> > i'm using the following connection string in global.asa:
> >
> > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> > dim cnn, cn, ProvStr
> >
> > Sub Session_OnStart
> > set cn = server.CreateObject("ADODB.Connection")
> > cn.Provider = "SQLOLEDB.1"
> > ProvStr = "Server=BYNIS052;Database=nbs;UID=sa;PWD=;"
> > cn.Open ProvStr
> > Set Session("cnn") = cn
> > End Sub
> >
> > Sub Session_OnEnd
> > cn.Close
> > End sub
> > </script>
> >
> > every 20 min. or so (the time i set in the config for session variables)
i
> > get a debugging message which asks for the variable 'cn'.
> > what to do?
> >
> > dirk
>
Message #4 by "David E" <registerukh@h...> on Wed, 27 Sep 2000 12:22:25 EDT
|
|
Dirk,
I hope I understood your problem correctly.
User session gets timed out every 20 mins (which is defalut) and the
session_onend event gets fired and closing the connection object. Here you
could increase the value of timeout property to say 30 or 40 mins (depending
on your requirement). This you could do on the server by going into the
properties of the app or by coding session.timeout=40 in each of your ASP
page.
But storing the connection object in the session variable, we are exactly
doing opposite to what is required to make our app scalable. It is
recommended (ofcourse, by our friends at Microsoft) to open the connection
to database in each page and close it in the same page as soon as we are
done using that database connection to make web app more scalable.
HTH
>From: "Neethling, Dirk BYNI/PLM" <Dirk.Neethling2@h...>
>Reply-To: "ASP Databases" <asp_databases@p...>
>To: "ASP Databases" <asp_databases@p...>
>Subject: [asp_databases] debug error for cn var in global.asa (OLEDB
>connection string)
>Date: Wed, 27 Sep 2000 13:13:12 +0200
>
>
> > i'm using the following connection string in global.asa:
> >
> > <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> > dim cnn, cn, ProvStr
> >
> > Sub Session_OnStart
> > set cn = server.CreateObject("ADODB.Connection")
> > cn.Provider = "SQLOLEDB.1"
> > ProvStr = "Server=BYNIS052;Database=nbs;UID=sa;PWD=;"
> > cn.Open ProvStr
> > Set Session("cnn") = cn
> > End Sub
> >
> > Sub Session_OnEnd
> > cn.Close
> > End sub
> > </script>
> >
> > every 20 min. or so (the time i set in the config for session variables)
>i
> > get a debugging message which asks for the variable 'cn'.
> > what to do?
> >
> > dirk
>
>---
>To place your message here, or to sponsor this list, please e-mail
>mailto:p2pinfo@w...?subject=MediaPack, remembering to provide contact
>details for yourself. We will e-mail you a Media Pack within 24 hours.
>
>You are currently subscribed to asp_databases
>$subst('Email.Unsub')
>---
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
Message #5 by "Ken Schaefer" <ken@a...> on Thu, 28 Sep 2000 12:09:08 +1000
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_01E4_01C02944.E77826E0
Content-Type: text/plain;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
I think you need to look very urgently at this page:
http://msdn.microsoft.com/library/default.asp?URL=3D/library/techart/pool
ing2.htm
(the URL might wrap). (sorry for the HTML mail, just wanted to keep the
original formatting)
<snip>
This article has repeatedly emphasized the need for developers who use
OLE DB resource pooling to keep at least one connection open for each
set of user credentials used to access the data store. This is not to be
confused with the mistake of opening up multiple and unnecessary
Connection objects, or even multiple Recordset objects. It's also not to
be confused with using just one Connection object for several hundred
Active Server Pages (ASP).
ASP developers should open one connection per set of unique user
credentials. However, an ASP developer can eliminate the benefits of
pooling in this scenario in the following ways:
a.. Using just one Connection object for multiple ASP pages. If you
don't want to circumvent the benefits of pooling, however, you can do
this: Within a given ASP page, open the Connection object and one or
more Recordset objects that you need. Then close and delete them.
</snip>
Basically never store ADO objects in session or application level
variables...
Cheers
Ken
----- Original Message -----
From: "Neethling, Dirk BYNI/PLM" <Dirk.Neethling2@h...>
To: "ASP Databases" <asp_databases@p...>
Sent: Wednesday, September 27, 2000 9:13 PM
Subject: [asp_databases] debug error for cn var in global.asa (OLEDB
connection string)
>
> > i'm using the following connection string in global.asa:
> >
> > <SCRIPT LANGUAGE=3DVBScript RUNAT=3DServer>
> > dim cnn, cn, ProvStr
> >
> > Sub Session_OnStart
> > set cn =3D server.CreateObject("ADODB.Connection")
> > cn.Provider =3D "SQLOLEDB.1"
> > ProvStr =3D "Server=3DBYNIS052;Database=3Dnbs;UID=3Dsa;PWD=3D;"
> > cn.Open ProvStr
> > Set Session("cnn") =3D cn
> > End Sub
> >
> > Sub Session_OnEnd
> > cn.Close
> > End sub
> > </script>
> >
> > every 20 min. or so (the time i set in the config for session
variables) i
> > get a debugging message which asks for the variable 'cn'.
> > what to do?
> >
> > dirk
Message #6 by Hal Levy <Hal.Levy@M...> on Thu, 28 Sep 2000 15:09:43 -0400
|
|
Dirk,
1. Take your connection out of the session
2. Take anything else that is in a session out of the session
3. If you insist on doing it this way, re-read 1 and 2.
The timeout means the time since the session was last accessed- so is it
happening when the session times out inactive or when the session is active
the whole time? the thing is.. CN doesn't exist on the session level. The
way I read this the cn goes away and cnn is now the reference.. but it's
referencing a object that is going away... then you cn.close an object that
doesn't exist...
If you insist on using the session.... use the session from the beginning
set session("cnn") = server.createobject("")
But, reconsider your design of using the session object.
Hal.Levy@M...
Senior Solutions Consultant
"Extending the Corporate Reach" (TM)
http://MediaServ.com
(xxx) xxx-xxxx Ext. 372
-----Original Message-----
From: Neethling, Dirk BYNI/PLM [mailto:Dirk.Neethling2@h...]
Sent: Wednesday, September 27, 2000 7:13 AM
To: ASP Databases
Subject: [asp_databases] debug error for cn var in global.asa (OLEDB
connection string)
> i'm using the following connection string in global.asa:
>
> <SCRIPT LANGUAGE=VBScript RUNAT=Server>
> dim cnn, cn, ProvStr
>
> Sub Session_OnStart
> set cn = server.CreateObject("ADODB.Connection")
> cn.Provider = "SQLOLEDB.1"
> ProvStr = "Server=BYNIS052;Database=nbs;UID=sa;PWD=;"
> cn.Open ProvStr
> Set Session("cnn") = cn
> End Sub
>
> Sub Session_OnEnd
> cn.Close
> End sub
> </script>
>
> every 20 min. or so (the time i set in the config for session variables) i
> get a debugging message which asks for the variable 'cn'.
> what to do?
>
> dirk
|
|
 |