Scheduling The Database Connector on Windows
The Data Everywhere Database Connector moves data between your database and a Data Everywhere feed. In order to have it run automatically, best practice is to use an external scheduler to run the Connector on the schedule you desire. Windows has a built-in scheduler called Task Scheduler. You can have a schedule entry for each query you would like to execute, but we recommend a simple batch file that invokes the Connector multiple times.
Here’s an example batch file (referred to below as sync-de.bat). Create a file called sync-de.bat, with just the following lines:
echo %DATE% %TIME% >> sync.log
<code>rem duplicate the following line for each query that you would like to execute
<code>DatabaseConnector.exe -q YOUR_QUERY_NAME >> sync.log
Replace the YOUR_QUERY_NAME with the name of a query from your connections.ini file. If you would like to run more than one query, please add one line for each. The results of each run will be logged to ” sync.log“; the Windows scheduler has very limited
To schedule this new task, open Task Scheduler and click “Create Task”. Give your task a memorable name.
Click next, and choose your frequency. We recommend Daily. If you would like it to run more often than Daily, choose Daily now, and we will modify the task schedule once it has been created.
We’ll want it to run every 1 days.This task will run a program.
We’ll configure the task to start a Windows prompt, and then run a batch file (.bat) that will execute each of the queries we would like to run, and log the results to a file. We’ve included a sample .bat file in the DatabaseConnector as “sync-de.bat”. Your “Program/script” will be “C:\Windows\System32\cmd.exe”, the arguments will be “/c sync-de.bat” (the script that determines which queries to run), and the “Start in” will be the directory that contains the batch file. Please note that we are running the Windows command interpreter, and passing it an option that says to run the batch file and then exit. DO NOT CHOOSE DatabaseConnector.exe AS THE SCHEDULED PROGRAM.
We recommend that you use a very simple bat, such as:
echo %DATE% %TIME% >> sync.log <br>
rem duplicate the following line for each query that you would like to execute
DatabaseConnector.exe -q YOUR_QUERY_NAME >> sync.log
We’ll confirm that it is properly established, and Finish.After you have added the task, it will be visible in the top folder of the Tasks library.
Let’s set some more details. You should probably have it run even when the user is not logged in; click the radio button here to configure it.
If you would like to run the task more frequently than hourly, double click on the task and go to the Triggers tab.
Adjust the task to start more frequently.
After you have scheduled the task, be sure to test it. Just highlight the task and push the “Run” button on the right hand side of Task Scheduler. If you are using our suggested .bat file, you should now see a sync.log file in the Connector directory, with an entry indicating that it just ran.
For more information on scheduling tasks, see also: https://support.microsoft.com/en-us/kb/226795.