Help with MySql

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mikeyd03
Newbie
Posts: 9
Joined: Tue Sep 14, 2004 2:27 pm

Help with MySql

Post by mikeyd03 » Fri Apr 14, 2006 4:01 pm

I'm using Macro Scheduler 8.01 to update a MySql database in batch mode.
I use it to upload a file with insert and update statements to a server, then connect in with SSH (using putty) then run the file. everything works great! My question - errors!
For instance, for a duplicate record a message will be on the screen, like "ERROR 1062 at line 2: Duplicate entry".
Is it possible to "read the screen" to see if there is an error message, and if so stop the macro?

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Apr 14, 2006 8:57 pm

The quick answer is YES.

Use the IfWindowOpen command to break out and process the contents

Code: Select all

Label>DoStuff
DoStuff
IfWindowOpen>ErrorWindowName*,ReadErrorMsg,DoStuff

Label>ReadErrorMsg
Process contents of window, depending on content.  Pehaps use a group of
FindWindowWithText>Error 1,1,Error1

If>Error1<>"NOT FOUND",%Error1%,DoOtherStuff

Label>Error1
Do stuff reacting to error code1
Goto>DoStuff

Label>DoOtherStuff
====================================
NOTE: the syntax above is not correct, just a quick sample of how this might be handled with some of Macro Scheduler's commands.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

mikeyd03
Newbie
Posts: 9
Joined: Tue Sep 14, 2004 2:27 pm

Post by mikeyd03 » Thu Apr 27, 2006 9:57 pm

I'm using putty.exe for an SSH connection.
I've been testing this and it seems to me that macro scheduler will detect the putty window open, but will not read the text in it.

Anyone using Macro Scheduler and SSH?

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Apr 27, 2006 10:17 pm

Doesn't Putty run in a DOS window?

Try the technique in this thread:

Good Luck,
Dick

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Apr 28, 2006 7:41 am

Why don't you install the MySQL ODBC drivers and then you can do all the SQL within the script directly and will not need to manipulate SSH.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

mikeyd03
Newbie
Posts: 9
Joined: Tue Sep 14, 2004 2:27 pm

Post by mikeyd03 » Fri Apr 28, 2006 6:22 pm

Don't think I can use ODBC, no external Mysql ports open.

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts