Hi

Hope someone can help with this as I dont really know where to start.

I am trying to automate a quite large txt feed I get from an external url to import into database. I currently do it manually through database software, but it takes too long each day.

Can anyone give me a pointer

Cheers

Recommended Answers

All 4 Replies

I can think of one solution that i have tried .First of all copy database from source to destination server and then import database into MySQL.

So both of these can be automated by using batch code and then adding the process to windows scheduler to schedule to execute batch file at paticular interval.

Create a batch file it will be similar to this

@ECHO OFF
for /f "tokens=1-4 delims=/ " %%a in ('date/t') do (
set dw=%%a
set mm=%%b
set dd=%%c
set yy=%%d
)

SET bkupdir=C:\path\to\where\you\want\backups
SET mysqldir=D:\path\to\mysql
SET dbname=this_is_the_name_of_my_database
SET dbuser=this_is_my_user_name

@ECHO Beginning backup of %dbname%...

%mysqldir%\bin\mysqldump -B %dbname% -u %dbuser% > %bkupdir%\dbBkup_%dbname%_%yy%%mm%%dd%.sql
@ECHO Done! New File: dbBkup_%dbname%_%yy%%mm%%dd%.sql
pause

and then use xcopy command to copy this file to another after this command in this batch file.

Then in your system similarly create batch code to import using mysql and add it to scheduler.

Hi

Thanks for your reply, but I only have to do 2 clicks and everything is imported manually. I am looking for something that is automated

In above example that i have given,you don't have to click.It is automated process.Datavase will be backed up than copied to another server and then it is imported in that server.No manual process.

Hi Sorry

My fault I did not read it correctly ,

Thanks you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.