473,396 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ADO Connection object in Session_OnEnd

Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
....
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in Session_OnEnd.
Jul 19 '05 #1
14 3940
>A Conn object is created the same way in Session_OnStart and is used
throughout the application
O, Boy thats a bad idea

--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl... Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in Session_OnEnd.

Jul 19 '05 #2
It might help if you tell us WHAT error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in Session_OnEnd.

Jul 19 '05 #3
Agoston Bejo wrote:
Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
What is the error? I suggest instead of posting it here, you go to
aspfaq.com and search for it there. You may get your answer quicker.
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).

http://www.aspfaq.com/2053
So I suppose the error is caused by the fact that we are in
Session_OnEnd.


Who can say without knowing what the error is?

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #4

"Roji. P. Thomas" <la********@nowhere.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl...
A Conn object is created the same way in Session_OnStart and is used
throughout the application

O, Boy thats a bad idea
Yeah, yeah, I think I know what you mean, but as far as I know, it's not
that bad idea if you close the connection at the end of every asp page and
reopen it at the beginning of them.

--
Roji. P. Thomas
Net Asset Management
https://www.netassetmanagement.com
"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in

Session_OnEnd.


Jul 19 '05 #5
Yes, how silly of me, I forgot that little detail:

Error message:
"Requested operation requires an OLE DB Session object, which is not
supported by the current provider."
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
It might help if you tell us WHAT error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in Session_OnEnd.


Jul 19 '05 #6
And what is the value of Application("Connection_String") ?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:un**************@TK2MSFTNGP15.phx.gbl...
Yes, how silly of me, I forgot that little detail:

Error message:
"Requested operation requires an OLE DB Session object, which is not
supported by the current provider."
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
It might help if you tell us WHAT error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = Application("Connection_String")
Conn.Open 'here is the error
...
End Sub
A Conn object is created the same way in Session_OnStart and is used
throughout the application, and Application("Connection_String") still
exists here (I tested).
So I suppose the error is caused by the fact that we are in Session_OnEnd.



Jul 19 '05 #7
Agoston Bejo wrote:
"Roji. P. Thomas" <la********@nowhere.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl...
A Conn object is created the same way in Session_OnStart and is used
throughout the application

O, Boy thats a bad idea


Yeah, yeah, I think I know what you mean,


Maybe you do, but your next statement makes me doubt it.
but as far as I know, it's
not that bad idea if you close the connection at the end of every asp
page and reopen it at the beginning of them.

Then what's the point of opening it in Session_OnStart? Maybe you misspoke
in your earlier message. When you said " ... and is used throughout the
application", were you talking about the connection object (bad) or the
connection string (good)?

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #8
Agoston Bejo wrote:
Yes, how silly of me, I forgot that little detail:

Error message:
"Requested operation requires an OLE DB Session object, which is not
supported by the current provider."

Hmm. What provider are you using?

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #9
"Provider=OraOLEDB.Oracle.1;Data Source=***;User ID=***;Password=***;Persist
Security Info=True;PLSQLRSet=1;"

Sorry, but I don't think I should provide the information that I've replaced
with ***.
I'm connecting to an Oracle 8.1.7 server.
Anyway, believe me that it works this way outside Session_OnEnd, since I
copied
it from Session_OnStart.

Many thanks

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
And what is the value of Application("Connection_String") ?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:un**************@TK2MSFTNGP15.phx.gbl...
Yes, how silly of me, I forgot that little detail:

Error message:
"Requested operation requires an OLE DB Session object, which is not
supported by the current provider."
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
It might help if you tell us WHAT error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
> Hi!
> Why doesn't the following code work?
>
> Sub Session_OnEnd
> Dim Conn
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.ConnectionString = Application("Connection_String")
> Conn.Open 'here is the error
> ...
> End Sub
>
>
> A Conn object is created the same way in Session_OnStart and is used
> throughout the application, and Application("Connection_String") still > exists here (I tested).
> So I suppose the error is caused by the fact that we are in

Session_OnEnd.
>
>



Jul 19 '05 #10

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:Oz**************@TK2MSFTNGP09.phx.gbl...
Agoston Bejo wrote:
"Roji. P. Thomas" <la********@nowhere.com> wrote in message
news:e%****************@TK2MSFTNGP11.phx.gbl...
A Conn object is created the same way in Session_OnStart and is used
throughout the application

O, Boy thats a bad idea


Yeah, yeah, I think I know what you mean,


Maybe you do, but your next statement makes me doubt it.
but as far as I know, it's
not that bad idea if you close the connection at the end of every asp
page and reopen it at the beginning of them.

Then what's the point of opening it in Session_OnStart? Maybe you misspoke
in your earlier message. When you said " ... and is used throughout the
application", were you talking about the connection object (bad) or the
connection string (good)?


It isn't opened in Session_OnStart.
In Session_OnEnd I open it only because I create a new Connection object.
(That part --"Conn.Open"-- doesn't come from Session_OnStart, all right.)
Actually, the connection object is put into a Session variable, and is
reopened and closed every time an asp page is processed.
From what you (and the others) say, it shouldn't be done this way, and I
should create a new Connection object in every asp page. Right?

Anyway, the original problem has not much to do with this, so let's now
concentrate on that part. (Why doesn't the newly created Connection
object --initialized with a valid connection string-- work in
Session_OnEnd?)

Thx

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #11
Agoston Bejo wrote:
From what you (and the others) say, it shouldn't be done this way,
and I should create a new Connection object in every asp page. Right?
Right

Anyway, the original problem has not much to do with this, so let's
now concentrate on that part. (Why doesn't the newly created
Connection
object --initialized with a valid connection string-- work in
Session_OnEnd?)


I've never seen this message, but that may be because I've only used the SQL
Server and Jet providers. I have no experience with the Oracle provider. The
only clue I can offer is that the IWAM account (not the IUSR) is the user
during Session_OnEnd. There may be some permissions lacking somewhere
(perhaps in the Registry) for this user. Sorry I can't be of more help. Have
you tried Google or an Oracle forum/newsgroup?

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #12
> Actually, the connection object is put into a Session variable, and is
reopened and closed every time an asp page is processed.
No, no, no, don't do this, ever.
From what you (and the others) say, it shouldn't be done this way, and I
should create a new Connection object in every asp page. Right?


Yes, always.
Jul 19 '05 #13
You can try disableing session pooling for this connection by adding

OLE DB Services=-2

to your connection string in this sub.

Bob Barrows

Agoston Bejo wrote:
"Provider=OraOLEDB.Oracle.1;Data Source=***;User
ID=***;Password=***;Persist Security Info=True;PLSQLRSet=1;"

Sorry, but I don't think I should provide the information that I've
replaced with ***.
I'm connecting to an Oracle 8.1.7 server.
Anyway, believe me that it works this way outside Session_OnEnd,
since I copied
it from Session_OnStart.

Many thanks

"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
And what is the value of Application("Connection_String") ?

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:un**************@TK2MSFTNGP15.phx.gbl...
Yes, how silly of me, I forgot that little detail:

Error message:
"Requested operation requires an OLE DB Session object, which is not
supported by the current provider."
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:eK**************@TK2MSFTNGP12.phx.gbl...
It might help if you tell us WHAT error.

--
http://www.aspfaq.com/
(Reverse address to reply.)


"Agoston Bejo" <gu***@freemail.hu> wrote in message
news:OO**************@TK2MSFTNGP11.phx.gbl...
> Hi!
> Why doesn't the following code work?
>
> Sub Session_OnEnd
> Dim Conn
> Set Conn = Server.CreateObject("ADODB.Connection")
> Conn.ConnectionString = Application("Connection_String")
> Conn.Open 'here is the error
> ...
> End Sub
>
>
> A Conn object is created the same way in Session_OnStart and is
> used throughout the application, and
> Application("Connection_String") still exists here (I tested).
> So I suppose the error is caused by the fact that we are in
> Session_OnEnd.


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #14
Agoston Bejo wrote:

This seems to have your answer:
http://groups.google.com/groups?hl=e...40cpmsftngxa09

The solution is to stop using a connection is Session, or impair performance
by turning OLEDB session pooling off

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: MostlyH2O | last post by:
Hi Folks, I'm having a hard time getting my Session_OnEnd event to fire in my global.asa. Here's what I have: <SCRIPT LANGUAGE=VBSCRIPT RUNAT=Server> SUB Session_OnStart Session.TimeOut =...
3
by: Tom Bates | last post by:
I can successfully delete files using fso.DeleteFile when in an ASP script. But in Session_OnEnd, where I'd *really* like to clean up files, it appears that DeleteFile doesn't work. I've tried...
24
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to...
4
by: Propin | last post by:
Have a problem with below code in global.asa. Same problem as described in this news group before, IWAM_machinename did not solve my problem. Have created the following test code (file is never...
4
by: anand | last post by:
In my website i want to trace the event when user log off from the site by closing the explorer so i am unable to run any server side program at that time and my session_onend event also not...
6
by: Martin | last post by:
Hi, Since I went ASP.NET with my global.asa (making it a global.asax) the application events are called just fine as well as the Session_OnStart event but the Session_OnEnd event is not. What is...
1
by: Andy Kasotia | last post by:
My Session_OnStart works but Session_OnEnd does not work. Here's the code...can anyone tell me what's wrong with my code or if anything else on the server that needs to be changed. The...
11
by: David Thielen | last post by:
Hi; Is there some kind of session ID variable that I can get in the code behind and that is available in Session_OnEnd() to know what session ended? -- thanks - dave...
4
by: Chris Ashley | last post by:
There seem to be isolated occurences of Session_OnEnd not firing in my app. This is problematic because some clean up of resources happens here. I know the Session events were unreliable in classic...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.