Southsoftware.com
   

SQL Automation with Task Scheduler

In Advanced Task Scheduler Professional and Network starting from version 4.3 you can run one or more SQL queries one by one via ODBC data sources.

This way you can execute SQL queries on any database that has its own ODBC driver. Advanced Task Scheduler can access a database by ODBC Data source or by ODBC Connection string.

ODBC Data source

You can create ODBC Data sources in the ODBC Data Source Administrator which is available from the Administrative Tools in Windows Control Panel. Each database has its own ODBC Configuration Wizard depending on its database engine.

In ODBC SQL shortcut type you only need to select the User DSN, System DSN or File DSN from the ODBC Data sources.

ODBC Connection string

The ODBC connection string consists of a set of property names and values separated by semi-colons. Basically, the properties are: the server address, database name, user name and password, but each connection string is different depending on your database engine.

In ODBC SQL shortcut type you need to enter your connection string manually in the Connection string field.

For example, to connect to the Microsoft SQL Server running on a server called ServerName, with Windows Authentication and Database called DatabaseName, you might use a connection string like this:

Driver={SQL Native Client};Server=ServerName;Database=DatabaseName;Trusted_Connection=Yes;

To connect to the PostgreSQL server running on a server called ServerName, with user and password authentication and Database called DatabaseName, you might use a connection string like this:

Driver={PostgreSQL ODBC Driver(UNICODE)};Server=ServerName;Port=5432;Database=DatabaseName;Uid=UserName;Password=Password;

To connect to the MySQL server running on a server called ServerName, with UTF8 character set and Database called DatabaseName, you might use a connection string like this:

Driver={MySQL ODBC 5.3 Unicode Driver};Server=ServerName;Port=3306;Charset=UTF8;Database=DatabaseName;Uid=UserName;Password=Password;

Note that you'll also need to select UTF8 charset in the Options section of the ODBC SQL shortcut type properties.

Character set

The SQL query is passed to the database driver unmodified in Unicode, however, if the query returns any response such as table rows and fields, the response will be treated as if it was encoded in the character set that is specified in the Options section of the ODBC SQL shortcut type properties.

References
ODBC SQL

Categories: Task scheduler

Leave a Reply

   
About us   Cookie policy   Privacy policy   Terms of use   Link to us