473,780 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADO Connection object in Session_OnEnd

Hi!
Why doesn't the following code work?

Sub Session_OnEnd
Dim Conn
Set Conn = Server.CreateOb ject("ADODB.Con nection")
Conn.Connection String = Application("Co nnection_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("Co nnection_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
14 3967

"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:Oz******** ******@TK2MSFTN GP09.phx.gbl...
Agoston Bejo wrote:
"Roji. P. Thomas" <la********@now here.com> wrote in message
news:e%******** ********@TK2MSF TNGP11.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=OraOL EDB.Oracle.1;Da ta Source=***;User
ID=***;Password =***;Persist Security Info=True;PLSQL RSet=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*****@dnartr eb.noraa> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. ..
And what is the value of Application("Co nnection_String ") ?

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


"Agoston Bejo" <gu***@freemail .hu> wrote in message
news:un******** ******@TK2MSFTN GP15.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*****@dnartr eb.noraa> wrote in message
news:eK******** ******@TK2MSFTN GP12.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******** ******@TK2MSFTN GP11.phx.gbl...
> Hi!
> Why doesn't the following code work?
>
> Sub Session_OnEnd
> Dim Conn
> Set Conn = Server.CreateOb ject("ADODB.Con nection")
> Conn.Connection String = Application("Co nnection_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("Co nnection_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
9519
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 = 30 END SUB
3
3071
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 every combination I could think of. I've verified the filespecs I'm using by logging to a session log file. BTW, I found out the hard way that I can't reference Request.ServerVariables("APPL_PHYSICAL_PATH") from within Session_OnEnd. I had to copy...
24
2463
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 login again, i bounce them to an error page. i use the session_onEnd sub within global.asa to remove their userID from the array at the end of their session, and this seems to work fine. however, if i just shut down the browser, the sub_onEnd...
4
6826
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 deleted on my IIS6 Win2003 environment, any idea?): <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart End Sub
4
2581
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 working can any one tell me why the session_onend is not working. Thanx in advance
6
2598
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 wrong? My global.asax looks like this: <%@ Application src="app.cs" Inherits="mwte.App" %>
1
2141
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 Session_OnStart does create the folder for me with the SessionID as the folder name but Session_OnEnd does not delete that folder. Sub Session_OnStart Dim fso, f, DirToCreate 'Create a folder to store PDF Files Set fso =...
11
2110
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 david_at_windward_dot_net http://www.windwardreports.com
4
1641
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 ASP, but is this still the case in ASP.Net? What kind of scenarios would case Session_OnEnd not to fire? Would Application_Error being hit cause Session_OnEnd not to fire?
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10139
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.