Page 1 of 1

Problem running mysql command using Run Program

Posted: Thu Aug 07, 2008 7:24 pm
by sgolba
In InstallAware, I need to create a new MySQL database, create tables, insert data into those tables, then add indexes and constraints. I am successfully using the "Run Program" command to create the database. I'm also successfully using the "My SQL Script" command to create its tables, as well as add indexes and constraints. However, I'm unable to successfully insert data into the tables using the "Run Program" command.

I need to use the "Run Program" instead of the "My SQL Script" command because some of my data is unicode. Therefore, I'm calling the following through the "Run Program" dialog:

Run Program: mysql
Hide Program Window: checked
Command Line Parameters: --host=$SERVERNAME$ --port=$MYSQLPORT$ --user=$DBUSERNAME$ --password="$DBPASSWORD$" --default-character-set=utf8 --database=$DBNAME$ < $SHORTTARGETDIR$\\Bin\\insert_data.sql
Wait For Program to Finish: checked
Return Result in Variable: MYSQLRET

All my variables are getting filled properly. And I can successfully run this same 'mysql' command from the command prompt.

The odd thing is, the "Run Program" command that initially creates the database using a "mysql" command is working fine. And its syntax is much the same:

Run Program: mysql
Hide Program Window: checked
Command Line Parameters: --host=$SERVERNAME$ --port=$MYSQLPORT$ --user=$DBUSERNAME$ --password="$DBPASSWORD$" --execute="CREATE DATABASE $DBNAME$ CHARACTER SET utf8 COLLATE utf8_general_ci;"
Wait For Program to Finish: checked
Return Result in Variable: MYSQLRET

As I said, between these two commands, I'm running a "My SQL Script" command that is successfully creating tables in the database.

By the way, I'm giving the user the option of using a SQL Server 2005 or MySQL database with my program. And the same type of 'insert data' SQL script (with unicode) is working fine calling 'sqlcmd' from a "Run Program" command.

Any ideas as to why the 'mysql' "Run Program" command to insert data isn't working?