473,516 Members | 2,889 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Periodically running asp page with timer

I have an asp page that will be updating the data from one database
into my sql server database every 3 hours. I'd like to write code that
will tell the page to automatically run every three hours. How do I do
this?

Thanks,

Bill
Jul 19 '05 #1
10 6802
Change to VBS and schedule with AT.
http://www.aspfaq.com/2143

Ray at home

--
Will trade ASP help for SQL Server help
"Bill" <bi***********@gospellight.com> wrote in message
news:8d**************************@posting.google.c om...
I have an asp page that will be updating the data from one database
into my sql server database every 3 hours. I'd like to write code that
will tell the page to automatically run every three hours. How do I do
this?

Thanks,

Bill

Jul 19 '05 #2
"Bill" <bi***********@gospellight.com> wrote in message
news:8d**************************@posting.google.c om...
I have an asp page that will be updating the data from one database
into my sql server database every 3 hours. I'd like to write code that
will tell the page to automatically run every three hours. How do I do
this?

Thanks,

Bill

http://www.aspfaq.com/show.asp?id=2143
Jul 19 '05 #3
"Ray at <%=sLocation%>" wrote:

Change to VBS and schedule with AT.
http://www.aspfaq.com/2143


I have a similar need**, but I also want to give certain users the ability
to manually trigger the process. I wanted to avoid maintaining duplicate
scripts (one ASP script for end users, one JS script for scheduling), so I
chose one.

How would you handle this situation, Ray?

I chose ASP, primarily so I could provide feedback while the script runs,
since a human user expects to see that the script is doing something. This
bumped me right into the old "how do I schedule an ASP script" problem, and
I initially solved it by setting up a job in SQL Server (the one that was
receiving the updates).

The job used MSXML (specifically, MSXML2.ServerXMLHTTP.4.0) to kick off the
script, and it worked flawlessly until we moved the DB server from NT4 to
Win2K. I have since found that I cannot get a scheduled task to successfully
use the ServerXMLHTTP object on a Win2K machine.

I can create a VBS or JScript file and launch it successfully while logged
in, but that same script will not run as a scheduled task. Ditto for
compiled executables and (as noted previously) SQL Server jobs.

Any suggestions, Ray?
**In my case, I need to take a snapshot of part of a proprietary DB and
stick it into a SQL Server DB, which is the data store for an intranet
application. The vendor supplied us with a somewhat crude API as our only
means of talking to their DB, and it is not flexible to talk with SQL Server
directly.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #4
You could still contain everything in a vbs file and then if you want a user
to be able to execute the script, use WshShell object to execute the vbs
file, if the user has permissions.

Ray at home

--
Will trade ASP help for SQL Server help
"Dave Anderson" <GT**********@spammotel.com> wrote in message
news:eA**************@TK2MSFTNGP10.phx.gbl...
"Ray at <%=sLocation%>" wrote:

Change to VBS and schedule with AT.
http://www.aspfaq.com/2143
I have a similar need**, but I also want to give certain users the ability
to manually trigger the process. I wanted to avoid maintaining duplicate
scripts (one ASP script for end users, one JS script for scheduling), so I
chose one.

How would you handle this situation, Ray?

I chose ASP, primarily so I could provide feedback while the script runs,
since a human user expects to see that the script is doing something. This
bumped me right into the old "how do I schedule an ASP script" problem,

and I initially solved it by setting up a job in SQL Server (the one that was
receiving the updates).

The job used MSXML (specifically, MSXML2.ServerXMLHTTP.4.0) to kick off the script, and it worked flawlessly until we moved the DB server from NT4 to
Win2K. I have since found that I cannot get a scheduled task to successfully use the ServerXMLHTTP object on a Win2K machine.

I can create a VBS or JScript file and launch it successfully while logged
in, but that same script will not run as a scheduled task. Ditto for
compiled executables and (as noted previously) SQL Server jobs.

Any suggestions, Ray?
**In my case, I need to take a snapshot of part of a proprietary DB and
stick it into a SQL Server DB, which is the data store for an intranet
application. The vendor supplied us with a somewhat crude API as our only
means of talking to their DB, and it is not flexible to talk with SQL Server directly.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #5
> I have a similar need**, but I also want to give certain users the ability
to manually trigger the process. I wanted to avoid maintaining duplicate
scripts (one ASP script for end users, one JS script for scheduling), so I
chose one.

How would you handle this situation, Ray?


Have the VBS script run on a schedule, and in the cases where you need to
trigger it from ASP, use WSH to fire off cscript, or see
http://www.aspfaq.com/2059 (of course the ASP page will have to be reached
through authentication, or IUSR given sufficient privileges).

You could also call MSXML from a scheduled SQL Server job, and call
msdb..sp_start_job on manual occasions.
Jul 19 '05 #6
"Ray at <%=sLocation%>" wrote:

You could still contain everything in a vbs file and then if
you want a user to be able to execute the script, use WshShell
object to execute the vbs file, if the user has permissions.


As noted originally, this precludes the possibility of giving feedback to
the user other than an ambiguous "job started" message. This is a problem
for a couple of reasons.

As you may recall the script reads the vendor's DB via the vendor's API.
What I didn't mention is that I have to use this extraction method for
several sets of data in the vendor's DB, and the API cannot read from two of
them simultaneously. In fact, if an attempt is made to read from one set
while another is being read from, both processes are killed. This is the
primary reason we mirror the data on SQL Server, since it makes simultaneous
searches in multiple data sets impossible (secondary: speed of retrieval,
which is on the order of .1 second per record returned, tertiary:
readability of web scripts due to the horrible API).

This is why I like to present feedback to the web user -- I spit out a bit
of output every 100 records, so he can see how far the job has progressed.
He can see when the job finishes and can run the next one. I suppose I can
prevent two jobs from running concurrently, but I'm certain the API doesn't
allow me to check, so I'll have to flag the start/finish events in SQL
Server**.

I have actually considered using the third suggestion here:
http://www.aspfaq.com/show.asp?id=2143, since this is a very high-traffic
application. I will have to give it some consideration.

**I already track job events for reporting purposes, so this isn't a great
burden, but I'm hesitant to use such abstracted logic, since there are
obviously situations that could arise (if the web server or SQL Server box
crashed in the middle of the job, for example) that would cause the job to
abort without an appropriate flag in the DB. Job initiation logic requiring
the completion of already started jobs would then leave me in a state that
disallows *any* jobs from running until the DB entry is cleared.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #7
"Aaron Bertrand - MVP" wrote:

Have the VBS script run on a schedule, and in the cases where you
need to trigger it from ASP, use WSH to fire off cscript, or see
http://www.aspfaq.com/2059 (of course the ASP page will have to
be reached through authentication, or IUSR given sufficient
privileges).
I think my response to Ray addresses the above. However...
You could also call MSXML from a scheduled SQL Server job, and
call msdb..sp_start_job on manual occasions.


Tried that already. I keep getting "access denied" errors when attempting to
use MSXML in a job. If you have any insight there, I'd be grateful, since
I'd be home free. My jobs were set up long ago, and only stopped working
when the DB moved from an NT4 box to a Win2K one.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #8
> Tried that already. I keep getting "access denied" errors when attempting
to
use MSXML in a job. If you have any insight there, I'd be grateful, since
I'd be home free. My jobs were set up long ago, and only stopped working
when the DB moved from an NT4 box to a Win2K one.


Well, who does SQL Server run as, local system account, a domain account,
....? Same question for SQL Server agent. This user must have permission to
instantiate the MSXML object, and I doubt a restricted user like local
system account has such permission (in fact this is why xp_cmdshell also
often fails when called from a job). If you set SQL Server Agent to log on
as a specific user, e.g. with local admin rights, then it should be able to
call COM objects no problem...
Jul 19 '05 #9
"Aaron Bertrand [MVP]" wrote:

Well, who does SQL Server run as, local system account, a domain
account, ...? Same question for SQL Server agent. This user must
have permission to instantiate the MSXML object, and I doubt a
restricted user like local system account has such permission
(in fact this is why xp_cmdshell also often fails when called
from a job). If you set SQL Server Agent to log on as a specific
user, e.g. with local admin rights, then it should be able to
call COM objects no problem...


I had already considered this, so I can tell you from memory that SQL Server
runs as system account, but SQL Server Agent runs as a local account in the
Administrators group.

I would have thought it was a permissions issue as well, except for the fact
that even scheduled tasks using MSXML fail -- even when logging in as me.
These are tasks that run successfully when I manually log on and launch
them.

I'm totally baffled.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #10
> I had already considered this, so I can tell you from memory that SQL
Server
runs as system account, but SQL Server Agent runs as a local account in the Administrators group.

I would have thought it was a permissions issue as well, except for the fact that even scheduled tasks using MSXML fail -- even when logging in as me.
These are tasks that run successfully when I manually log on and launch
them.

I'm totally baffled.


I created a scheduled job this morning that calls a stored procedure that
uses sp_oaCreate to fetch a URL using MSXML and then again to send a mail
using CDO. No problems.

SQL Server *and* SQL Server agent are set up to log on as a local
administrator (both of these settings were changed in the Services applet in
the control panel, not in Enterprise Mangler). The stored procedure, of
course, has been granted EXEC privileges to domain\user. This is SQL Server
2000 SP3, on Windows Server 2003.
Jul 19 '05 #11

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

Similar topics

1
6013
by: Antoine | last post by:
Hello, Does anybody know a way to retreive the running timers (their ids) in a html page? I cannot find something in the html dom at first sight. Is there collection of timers available (like window.all, forms, frames and such)? Some other way? When you create a timer (setTimeout), the return value is the timer id.
4
2642
by: Todd | last post by:
I have an ASP.NET application and I would like to have some code run on the server automatically once a day at a specified time. I create a timer thread to call a simple callback in the Application_Start method. It seems to call the callback once or twice while the application starts up but appears to stop once the default page is...
1
5993
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the browser back button, it loads the progress bar again. Any solution to this?
3
1688
by: Steven Nagy | last post by:
Hi all, I have a problem where I am developing a site for a client that needs to perform a certain analysis against the database every hour, on the hour. The problem is that the hosting company will only allow a standard ASP.NET web app to be run on their server; no EXE's can be run. So I am not sure how I would implement functionality to...
10
1566
by: Ryan | last post by:
I'm creating a website that monitors the status of servers using My.Computer.Network.Ping. I'm looking for a way to fire off my Ping() function every second or so. I see a Timer control availalble for Windows forms but it is not listed for my .ASPX page. Is there such a control? Thanks.
4
1652
by: =?Utf-8?B?QW1yaXQgS29obGk=?= | last post by:
Hello, I have a button that starts up a Thread and runs it in the background. While the Thread is running, all the Ajax controls, including the events fired by the PageRequestManager, stop firing until the Thread exits. So, I have no way of updating the page while this Thread is running, which was the point of putting it on the Thread. ...
1
1149
by: vsrprasad16 | last post by:
Hi All, Am new to threading concepts. i want to start a thread with a method DoProcess and run this method periodically at some time interval. for this i implemented like below. public void startWatcher(bool setTimer) { TimerCallback timerdelg = new TimerCallback(start); tmr = new Timer(timerdelg, null,...
8
1571
by: Curious | last post by:
Hi, Are there known issues with running two timers at the same time? I have bumped into a problem - I start a first timer at an interval of 5 seconds. 15 seconds later, I start a second timer at 15 seconds interval. That's when things start to fail with the first timer (it doesn't seem to do what it should do). My seconds question: Is...
6
1670
by: RussCRM | last post by:
I'm using the Access User-Level Security features with various users set up. I have a form/timer all set up to trigger an event after a period of inactivity. I'd like that event to log off a user and force them to log back in or to require them to login periodically. The reason for this is that multiple people use the database and I...
0
7276
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
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...
0
7408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7142
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...
0
7548
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...
0
3267
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...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
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
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.