473,787 Members | 2,932 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DOS Batch File Running osql - opening/closing connections

I've written a small dos batch script that runs a simple query through
osql and then calls an exe which sends an email if the returned value
0.
The query checks if a value in a column has not been updated for 5
mins and raises a warning through an email and it will need to run
throughout the online day.

Will there be any issues continually opening & closing connections in
this way?

Would there be any advantage in scheduling it as a job in Windows v a
scheduled job in SQL Server to run every 5 mins?

Thanks.

Jul 20 '07 #1
2 4887
I don't see a problem with running a polling process like this every 5
minutes. Personally, I'd do this in SQL Agent job with a single
Transact-SQL step and use database mail if SQL 2005 or xp_smpt_sendmai l
(http://www.sqldev.net/xp/xpsmtp.htm) if SQL 2000.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Stephen2" <St*****@mailin ator.comwrote in message
news:11******** *************@5 7g2000hsv.googl egroups.com...
I've written a small dos batch script that runs a simple query through
osql and then calls an exe which sends an email if the returned value
>0.

The query checks if a value in a column has not been updated for 5
mins and raises a warning through an email and it will need to run
throughout the online day.

Will there be any issues continually opening & closing connections in
this way?

Would there be any advantage in scheduling it as a job in Windows v a
scheduled job in SQL Server to run every 5 mins?

Thanks.
Jul 20 '07 #2
On Jul 20, 1:40 pm, "Dan Guzman" <guzma...@nospa m-
online.sbcgloba l.netwrote:
I don't see a problem with running a polling process like this every 5
minutes. Personally, I'd do this in SQL Agent job with a single
Transact-SQL step and use database mail if SQL 2005 or xp_smpt_sendmai l
(http://www.sqldev.net/xp/xpsmtp.htm) if SQL 2000.
Thanks Dan, that would be a better way but I couldn't get either sql
mail or xp_smpt_sendmai l to work. It's a bit like the blind leading
the blind here. I just need a quick & easy solution in the short term.

Jul 20 '07 #3

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

Similar topics

1
3405
by: hananiel | last post by:
Hello: We have a a two tier application connecting to sql server through remoting. The business objects are single call objects. We are opening and closing connections using ADO.NET command object. All "ExecuteNonQuery" are closed in finally blocks. We are running out of sql connections because the profiler shows that connections are not being released till the business service is stopped and restarted. Does anyone have suggestions on how...
4
47541
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup) 4) Once the copy is complete, the batch file opens the Access database again 5) EXIT should close out the cmd window but it does not execute that line
0
3169
by: Andrew Dowding | last post by:
Hi Everybody, I have been looking at problems with my Windows Forms C# application and it's little Jet 4 (Access) database for the last few days. The Windows Forms app implements a facade and implementation, data abstraction layer. But because each data adapter in the implementation layer has a connection object that opens and closes as needed, I found I got several errors from the Jet engine when there were simultaneous connections to...
6
11238
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running programs and executing registry entries. The majority of my buttons work however, I have come upon a problem. I need a few of the buttons to run DOS batch files, the batch files in turn run program installers (specifically windows update runtime .exe...
1
3204
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running programs and executing registry entries. The majority of my buttons work however, I have come upon a problem. I need a few of the buttons to run DOS batch files, the batch files in turn run program installers (specifically windows update runtime .exe...
2
5257
by: | last post by:
Hi, I have just started using MSSQL and the DOS environment at work. I have a lot of experience with Sybase and the UNIX environment, but this is a whole new ball of wax. I'd like to use osql from a batch file to log into the dataserver and run a fairly long list of SQL and then exit. I don't want to have a bunch of SQL files sitting around that I have to use the -i option to run, and I'd rather not create temporary SQL files like...
7
2589
by: David R. | last post by:
Hello all, I would like to generate a Sql-Script-File and a Batch-File to execute the Batch-File over C#-Code and use the SQL-File as an Input-File for the command "osql" in the Batch-File. I generate the two files "attachDB.sql" and "setup.bat" with the following code: AttachAtpDBFile = File.CreateText(@"c:\attachDB.sql"); AttachAtpDBFile.AutoFlush = true;
2
37648
by: raghutumma | last post by:
Hi, How can we execute SQL Scripts using Batch file??? i think Batch file should contain Username,Password,Database and Scripts... Using that file scripts should run... How can i give UserName,Password,Database and all those things?
4
2467
by: kessa | last post by:
Hi Guys, I've recently had a problem with my site displaying a "system resources exceeded" error message ... and whilst searching this site for a solution (which I think I've now found) I came across mention of closing database connections and so had a "best practice" question which I hoped someone might be able to help me with? I'm a .asp newbie and much of what I have learnt has been done by looking at various snippets of code on the web...
0
9497
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
10169
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
10110
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
8993
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...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
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
3670
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.