InstallShield calls batch processing to deploy a MySQL database

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.