How do you automate sql scripts? Such as running it once a month.

makerbiles6's profile image makerbiles6 posted 4 years ago in Running SQL scripts Permalink

Like downloading a text or csv file from a website, load data from it to your table, a bunch of queries to validate data or remove invalid data.

Is it possible to call SQL scripts from a JAVA program? Or can this be done through batch or Python which I’m unfamiliar with.

Novice user here. What’s the usual process like? Can it be done in one press of a button?

ansgar's profile image ansgar posted 4 years ago Permalink

For some scheduled program execution, I write my scripts in PHP, and call these per crontab on a server. On a Linux server's command line, run crontab -e to edit your scheduled tasks. This is very efficient and reliable, as a server usually is monitored and up-to-date. PHP itself can interact easily with MySQL, download files from external servers, manipulate these with its myriad of string functions, etc.

HeidiSQL is a GUI application, not made for scheduled tasks, but for doing things interactively.

ansgar's profile image ansgar posted 4 years ago Permalink

Btw, although I have no personal experience with it, Python is also a very good choice. I think it's slightly simpler than PHP, but can handle the same stuff, and it's highly extensible to your needs.

There is also the pure shell script language on Linux, and the command line on Windows (plus the more powerful Powershell). But these are quite limited when you want more complex logic.

Please login to leave a reply, or register at first.