New Window Kills Browser When Connected to Oracle

C

colin.steadman

I have an ASP page setup for doing maintenance jobs in Oracle.
Clicking a maintenance job spawns a new window (cut down to a small
size with Javascript) and the jobs runs.

Just before processing starts I output a message to the user in this
new window using a span (with an ID) using Response.Flush. This is to
let the user know that processing has started.

After the procedure has completed, I update the span message using its
ID with 'processed' or 'failed' accordingly.

So far so good!

The problem I have is that it only worked during development. This
seems to be because during development I used an example I picked up
from the ASPFAQ site to simulate database activity (ie a 15 second
delay) without actually doing anything using SQLServer:

sleep = 15
cn.open "Provider=sqloledb;Data Source=SVR;User Id=id;Password=pw"
cn.Execute "WAITFOR DELAY '00:00:" & sleep & "'"

With the above script everything worked great, and I could open three
or four different procedures and have them all running simultaneously.
Just what I wanted!

However when I switched to running the actual procedures Oracle (which
take a couple of minutes) I've found that it will only run one
procedure at a time. And while this one procedure is running I lose
communication with the parent window (the list of jobs) until the
procedure has finished.

Does anyone have any idea what might be causing this? The only
difference (apart from the SQL) between running in live (Oracle) and
simulating activity using SQL Server is the Provider. Could the Oracle
provider be missing something the SQL Server Provider has? And if so,
what might this be and can I get round it?

I've copied an example maintenance job page below.

TIA,

Colin


<%@Language=VBScript%>
<%Option Explicit%>
<%Session.LCID = 2057%>

<!-- #INCLUDE FILE="functions.asp" -->
<!-- #INCLUDE FILE="formatting.asp" -->

<head>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
</head>

<body id="oBody"
style="filter:progid:DXImageTransform.Microsoft.Fade(duration=2);font-weight:bold;font-size:10pt;font-family:arial;tahoma">


<div id=messageToUserTxT
style="background-color:3996FF;color:ffffff;position: absolute; left:
0; top: 0;">
Processing Receipts...
</div>


<table height="100%" width="100%">
<tr>
<td align=center>Process Receipts</td>
</tr>
</table>


<%
Response.flush()

Dim cn
Dim sql
Dim arSQL()
Dim sleep
Dim testing

'Setup SQL
Redim arSQL(2)
arSQL(0) = "begin"
arSQL(1) = " Pacs_Inbound_Api.Process_Receipts;"
arSQL(2) = "end;"

'Setup connection
Set cn = Server.CreateObject("ADODB.Connection")

'RUN AS TEST OR LIVE?
testing = True
'testing = False


If testing Then
'TESTING
Server.ScriptTimeout = 20
sleep = 15
cn.open "Provider=sqloledb;Data Source=SVR;User Id=id;Password=pw"
cn.commandTimeout = 15
cn.Execute "WAITFOR DELAY '00:00:" & sleep & "'"
Else
'LIVE
Server.ScriptTimeout = 600
cn.open "Provider=OraOLEDB.Oracle;Data Source=SVR;User
Id=id;Password=pw"
cn.execute Join(arSQL,"")
End If

'Destroy SQL array
Erase arSQL

If Err.number <> 0 Or cn.Errors.Count <> 0 Then
response.write "<br>" & err.Description
%>
<script language=javascript>
// After setting Apply, changes to the oBody object
// are not displayed until Play is called.
oBody.filters[0].Apply();
oBody.style.backgroundColor="FFD3D3";
oBody.filters[0].Play();
messageToUserTxT.innerText = ' Processing failed! ';
</script>
<%
Else
%>
<script language=javascript>
// After setting Apply, changes to the oBody object
// are not displayed until Play is called.
oBody.filters[0].Apply();
oBody.style.backgroundColor="CEFFC2";
oBody.filters[0].Play();
messageToUserTxT.innerText = ' Processing complete! ';
</script>
<%
End If

cn.Close: Set cn = Nothing

%>

</body>
</html>
 
M

Mark Schupp

IIRC an ASP session can only have a single script processing at a given
time.

--
--Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com

I have an ASP page setup for doing maintenance jobs in Oracle.
Clicking a maintenance job spawns a new window (cut down to a small
size with Javascript) and the jobs runs.

Just before processing starts I output a message to the user in this
new window using a span (with an ID) using Response.Flush. This is to
let the user know that processing has started.

After the procedure has completed, I update the span message using its
ID with 'processed' or 'failed' accordingly.

So far so good!

The problem I have is that it only worked during development. This
seems to be because during development I used an example I picked up
from the ASPFAQ site to simulate database activity (ie a 15 second
delay) without actually doing anything using SQLServer:

sleep = 15
cn.open "Provider=sqloledb;Data Source=SVR;User Id=id;Password=pw"
cn.Execute "WAITFOR DELAY '00:00:" & sleep & "'"

With the above script everything worked great, and I could open three
or four different procedures and have them all running simultaneously.
Just what I wanted!

However when I switched to running the actual procedures Oracle (which
take a couple of minutes) I've found that it will only run one
procedure at a time. And while this one procedure is running I lose
communication with the parent window (the list of jobs) until the
procedure has finished.

Does anyone have any idea what might be causing this? The only
difference (apart from the SQL) between running in live (Oracle) and
simulating activity using SQL Server is the Provider. Could the Oracle
provider be missing something the SQL Server Provider has? And if so,
what might this be and can I get round it?

I've copied an example maintenance job page below.

TIA,

Colin


<%@Language=VBScript%>
<%Option Explicit%>
<%Session.LCID = 2057%>

<!-- #INCLUDE FILE="functions.asp" -->
<!-- #INCLUDE FILE="formatting.asp" -->

<head>
<meta http-equiv="content-type" content="text/html;
charset=iso-8859-1">
</head>

<body id="oBody"
style="filter:progid:DXImageTransform.Microsoft.Fade(duration=2);font-weight:bold;font-size:10pt;font-family:arial;tahoma">


<div id=messageToUserTxT
style="background-color:3996FF;color:ffffff;position: absolute; left:
0; top: 0;">
Processing Receipts...
</div>


<table height="100%" width="100%">
<tr>
<td align=center>Process Receipts</td>
</tr>
</table>


<%
Response.flush()

Dim cn
Dim sql
Dim arSQL()
Dim sleep
Dim testing

'Setup SQL
Redim arSQL(2)
arSQL(0) = "begin"
arSQL(1) = " Pacs_Inbound_Api.Process_Receipts;"
arSQL(2) = "end;"

'Setup connection
Set cn = Server.CreateObject("ADODB.Connection")

'RUN AS TEST OR LIVE?
testing = True
'testing = False


If testing Then
'TESTING
Server.ScriptTimeout = 20
sleep = 15
cn.open "Provider=sqloledb;Data Source=SVR;User Id=id;Password=pw"
cn.commandTimeout = 15
cn.Execute "WAITFOR DELAY '00:00:" & sleep & "'"
Else
'LIVE
Server.ScriptTimeout = 600
cn.open "Provider=OraOLEDB.Oracle;Data Source=SVR;User
Id=id;Password=pw"
cn.execute Join(arSQL,"")
End If

'Destroy SQL array
Erase arSQL

If Err.number <> 0 Or cn.Errors.Count <> 0 Then
response.write "<br>" & err.Description
%>
<script language=javascript>
// After setting Apply, changes to the oBody object
// are not displayed until Play is called.
oBody.filters[0].Apply();
oBody.style.backgroundColor="FFD3D3";
oBody.filters[0].Play();
messageToUserTxT.innerText = ' Processing failed! ';
</script>
<%
Else
%>
<script language=javascript>
// After setting Apply, changes to the oBody object
// are not displayed until Play is called.
oBody.filters[0].Apply();
oBody.style.backgroundColor="CEFFC2";
oBody.filters[0].Play();
messageToUserTxT.innerText = ' Processing complete! ';
</script>
<%
End If

cn.Close: Set cn = Nothing

%>

</body>
</html>
 
C

colin.steadman

Humm, that makes sense. Are there any ways of getting the script to
run in another session to avoid this?

Thanks Mark,

Colin
 
E

Evertjan.

(e-mail address removed) wrote on 16 dec 2004 in
microsoft.public.inetserver.asp.general:
Humm, that makes sense. Are there any ways of getting the script to
run in another session to avoid this?

What makes sense?

This is not email but usenet, so please quote the Q you are answering on.
 
M

Mark Schupp

Not easily. The session cookie is usually associated with the browser
process. In order to get a separate session you need to open the new browser
window in a separate process. There used to be a setting for this in IE 4
(it usually caused problems by NOT sharing sessions between browser
windows).

Would it be possible to have the user select a set of operations to perform
and then run them sequentially?
 
C

colin.steadman

What makes sense?
This is not email but usenet, so please quote the Q you are answering
on.

Your right. I'm posting from the Google Groups beta, and it doesn't
seem to include the original post like the old one used to. There is
probably an option for it somewhere but I cant find it. To quote you
post, I've had to cut and paste into the reply form...
 
C

colin.steadman

Would it be possible to have the user select a set of operations to
perform
and then run them sequentially?

Possibly. I'd better talk to the users and see how import this is.

The only other option might be to use ASP to kick off a VBScript and
not wait for it to return... But I've tried this before and had
terrible problems with permissions and never did get it working.
Thanks for posting.

Colin
 
M

Mark Schupp

Other options:

MSMQ (Microsoft Message Queuing) to trigger processing by external program,
then send email back to user or set a flag in a file some where that an ASP
page can check peridically (use refresh metatag, not time delay on server).

Create a batch file in a specific directory to run the job. Have a scheduled
task look for new files and run them. Notify user as above. Should be able
to create a windows service that detects new files in the directory.

Use stored procedures which run asynchronously. I have heard of this for
SQLServer, not sure if it can be done with Oracle.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top