469,306 Members | 2,512 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

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 3804
>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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Propin | last post: by
4 posts views Thread by anand | last post: by
6 posts views Thread by Martin | last post: by
1 post views Thread by Andy Kasotia | last post: by
11 posts views Thread by David Thielen | last post: by
4 posts views Thread by Chris Ashley | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.