is this job possible

[expired user #8897]'s profile image [expired user #8897] posted 9 years ago in General Permalink
hi,

tks for the heidi software and this forum.. smile

I 'd like to send a new csv file to a mysqltable every week.
Is it possible to send a cron job (let's say every week) to heidi to achieve such task ?

Tks
ansgar's profile image ansgar posted 9 years ago Permalink
No, HeidiSQL ist not really able to run scheduled tasks.

You should use the mysql console for doing such things. If you're on Windows, you can trigger the job using the "Task planning" or however it's called in english:
c:\path\to\mysql\mysql.exe -hlocalhost -umyuser -e "LOAD LOCAL DATA INFILE 'c:\\path\\to\file.csv' REPLACE INTO TABLE `yourdatabase`.`yourtable` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' CHARACTER SET utf8;"
[expired user #8897]'s profile image [expired user #8897] posted 9 years ago Permalink
Hi ansgar,
Tks for your reply !
ok i see..

so the job is to schedule via "task planning" the command line you mention ? Is that right ? If yes, how to then register such command to be launched later on by windows ?

tks again..
kalvaro's profile image kalvaro posted 9 years ago Permalink
The English term is Task Scheduler. I'd suggest you try it yourself first.
[expired user #8897]'s profile image [expired user #8897] posted 9 years ago Permalink

The English term is Task Scheduler. I'd suggest you try it yourself first.



Hi kalvaro tks..

ok but try what ? as i don't know how to send this command to the task scheduler :(
ansgar's profile image ansgar posted 9 years ago Permalink
You can run your task scheduler from within your control panel > "Administrative Tools". Or just click start, type + run "Taskschd.msc".

Then,
* click "Create a simple task"
* configure the trigger time
* in the "Start application" section:
** type your path to mysql.exe, e.g.: "c:\Program Files\MySQL\mysql.exe"
** in the "Arguments" input box, type in the parameters from above, e.g.:
-hlocalhost -umyuser -e "LOAD LOCAL DATA INFILE 'c:\\path\\to\file.csv' REPLACE INTO TABLE `yourdatabase`.`yourtable` FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' CHARACTER SET utf8;"
[expired user #8897]'s profile image [expired user #8897] posted 9 years ago Permalink
Hi ansgar,

Ok ! that's so clear now for me..many thanks for your help...

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