Note: InstallShield version: 2010
Requirement: automatically deploy the MySQL database
Implementation Method: first install MySQL ODBC on the welcome machine to test whether the user name and password entered by the customer are correct, and call batch processing to automatically deploy the database
Because the Chinese characters are garbled during the execution of MySQL scripts to import data using ODBC, this problem has not been solved, so we can't just think of calling batch processing to achieve automatic MySQL deployment! Import the SQL script file to be imported from mysql.exe in the root directory of mysqlinstallation, And the batch processing of imported data written by yourself.
I. InstallShield calls the external MySQL ODBC MSI installation package to implement MySQL ODBC deployment
1> in behavior and logic-> support files/billboards
Support files-> Add the external MSI file to be called under language independent
Add code in the onbegin event to determine whether MySQL ODBC exists and install MySQL ODBC.
szKey="//SOFTWARE//ODBC//ODBCINST.INI//MySQL ODBC 3.51 Driver";
nResult=RegDBKeyExist(szKey);
if(nResult<0) then
szParam="/i "+SUPPORTDIR^"MyODBC.msi"+" /qb";
if(LaunchAppAndWait("msiexec.exe",szParam,WAIT)<0) then
MessageBox("Mysql ODBC Install failed!",INFORMATION);
endif;
endif;
Ii. InstallShield calls external programs
1> in behavior and logic-> support files/billboards
Support files-> Add external executable files to be called under language independent
This is the batch file for installing the database.
2> Add code to batch after the onsqllogin event of setup. rul script file
Transmit the Server IP address, user name, and Database Password parameters.
If (bnext) then
// Add the database installation code here
Szparam = szserver + "" + szuser + "" + szpassword;
// MessageBox (szparam, mb_ OK );
Launchappandwait (suppdir dir ^ "bat. Bat", szparam, wait );
Return next;
Else
Return back;
Endif;
In this way, when you click Next in the database login interface during installation, execute the code here to install the database to achieve automatic deployment of the MySQL database.