[Developer Guide] install and uninstall an SQL Server Database Using InstallShield

Source: Internet
Author: User

This document describes how to useInstallShieldInstall and uninstall the database, andInstallShield 11.5 premier EditionAndInstallShield 12 premier EditionEnvironment. (AboutInstallShieldSuch a well-known InstallationProgramI will not introduce the production tools much.)

(InInstallShieldPackage in. NET FrameworkSee about Using InstallShield to deploy. NET Framework) Zhang Lei. Live

1. Open "SQL scripts View", 1

 
Figure 1. Open the SQL Script View

2

, Create a connection, assuming"Masterconnection", According to the figure2And Graph3Set the connection attributes.


Figure 2 establish a connection

Figure 3 set connection attributes

3In theMasterconnection", CreateScript, Attribute settings4,ScriptThe content is as follows:

1 Use Master
2
3 If   Not   Exists ( Select   *  
4
5 From Master. DBO. sysdatabases
6
7 Where Name =   ' Relaybookkeeping ' )
8
9 Create   Database   ' Relaybookkeeping '
10
11 Go
12

Note:RelaybookkeepingIs the database we need to create.

 
Figure 4CreateScript

4, New Connection"Relaybookkeepingconnection", According to the figure5SetGeneralAttribute.RequirementsAttribute settings3.

 
Figure 5 set connection attributes

5In theRelaybookkeepingconnectionCreate your own database script.6.

 
Figure 6 add your own database script

6, Delete the database when you uninstall the program.

Procedure1,2,3. Create a connection,GeneralOn the properties page, set the database nameMaster. Then addScriptFile,RuntimeWhen the property is set to uninstall, the content is:

Use Master

Drop DatabaseRelaybookkeeping

Go

 

[Edit the following content at]

I saw in my help today that I installed SQL Server and Oracle. Post at the end.

 

Creating a sample project that will create a SQL Server catalog by running customized SQL script

Task

The following describes how to create a sample project that will create a SQL Server catalog on the target machine by running customized SQL script:

  1. Create a new InstallShield project.
  2. Go toProperty ManagerView.
  3. Create a new property named "is_sqlserver_database2 ".
  4. Go toSQL scriptsView.
  5. Create a new connection and call it "newconnection1 ".
  6. Click newconnection1 In the explorer, and select the General tab.
  7. Specify "testsqlserver" as the target server name, and clearCreate catalog if absentOption.
  8. SelectServer AuthenticationOption and specify "sa" asLogin IDAnd leavePasswordField blank.
  9. ClickRequirementsTab.
  10. Select the SQL Server check box and clear the Oracle and MySQL check boxes as the target databases.
  11. Right-clickNewconnection1In the explorer, and chooseNew script.
  12. Rename the new script "newscript1 ".
  13. SelectNewscript1In the explorer, and clickScriptTab.
  14. Add the following script:
  15.  
    Create Database [testdb] On (name = n' testdb', filename = n' c: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ testdb. MDF ', size = 3, filegrowth = 10%) log on (name = n' testdb_log', filename = n' C: \ Program Files \ Microsoft SQL Server \ MSSQL \ data \ testdb. ldf', size = 1, filegrowth = 10%)
     
    Collate SQL _latin1_general_cp1_ci_as

  16. ClickRuntimeTab, selectRun script during login, And then clear the other script execution options.
  17. Create a new connection inSQL scriptsView, and call it "newconnection2 ".
  18. ClickNewconnection2In the explorer, and selectAdvancedTab.
  19. FromTarget catalog property nameBox, choose is_sqlserver_database2.
  20. ClickGeneralTab.
  21. Specify "testsqlserver" as the target server name and "testdb" as the catalog name, and then clearCreate catalog if absentOption.
  22. SelectServer AuthenticationOption and specify "sa" asLogin IDAnd leavePasswordField blank.
  23. ClickRequirementsTab.
  24. SelectSQL ServerCheck box and clearOracleAndMySQLCheck boxes as the target databases.
  25. Right-clickNewconnection2In the explorer, and chooseNew script.
  26. Rename the new script "newscript2 ".
  27. SelectNewscript2In the explorer, and clickScriptTab.
  28. Add the following script:
  29. Create Table testtable (testcolumn1 char not null primary key)

  30. Click the runtime tab, select run script during install, and then clear the other script execution options.

 

Creating a sample project that will create an oracle catalog by running customized SQL script

Task

The following describes how to create a sample project that will create an oracle catalog on the target machine by running customized SQL script:

  1. Create a new InstallShield project.
  2. Go toProperty ManagerView.
  3. Create a new property named "is_sqlserver_database2 ".
  4. Go toSQL scriptsView.
  5. Create a new connection and call it "newconnection1 ".
  6. ClickNewconnection1In the explorer, and selectGeneralTab.
  7. Specify "// sch01jsmith.macrvision.com: 1521/orcl" as the target server name, and clearCreate catalog if absentOption.
  8. SelectServer AuthenticationOption and specify "Scott" as the login ID and "Scott" as the password.
  9. ClickRequirementsTab.
  10. SelectOracleCheck box and clearSQL ServerAndMySQLCheck boxes as the target databases.
  11. Right-clickNewconnection1In the explorer, and chooseNew script.
  12. Rename the new script "newscript1 ".
  13. SelectNewscript1In the explorer, and clickScriptTab.
  14. Add the following script:
  15.  
    Create tablespace test_ts logging datafile '/muddle/Oracle/STs/test01.dbf' size 64 K autoextend on next 2 m maxsize Unlimited
     
    Go
     
    Create user test_user identified by mypswd default tablespace test_ts quota unlimited on test_ts
     
    Go
     
    Grant connect to test_user
    Go
     
    Grant DBA to test_user
     
    Go
     
    Alter user test_user default role all
     
    Go
  16. ClickRuntimeTab, selectRun script during login, And then clear the other script execution options.
  17. Create a new connection inSQL scriptsView, and call it "newconnection2 ".
  18. ClickNewconnection2In the explorer, and selectAdvancedTab.
  19. FromTarget catalog property nameBox, choose is_sqlserver_database2.
  20. ClickGeneralTab.
  21. Specify "// sch01jsmith.mac rvision.com: 1521/orcl" as the target server name and "test_user" as the catalog name, and then clearCreate catalog if absent Option.
  22. SelectServer AuthenticationOption and specify "test_user" as the login ID and "mypswd" as the password.
  23. ClickRequirementsTab.
  24. SelectOracleCheck box and clearSQL ServerAndMySQLCheck boxes as the target databases.
  25. Right-clickNewconnection2In the explorer, and chooseNew script.
  26. Rename the new script "newscript2 ".
  27. Select newscript2 In the explorer, and click the script tab.
  28. Add the following script:
  29.  
    Create Table testtable (testcolumn1 char not null primary key)

  30. ClickRuntimeTab, selectRun script during install, And then clear the other script execution options.

 

-->

-->

-->

-->

Related Article

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.