MSDE automatic installation method

xiaoxiao2021-03-06  57

MSDE automatic installation method

First, make automatic installation SQL

It has been made, the program is put:

// Project / Installation Dish Making / MSDE

Note: The automatic installation purpose is to install without the screen when the MSDE installer is executed, and automatically install it according to the configuration step;

Automatic configuration file unattend.iss production method:

Start the installation with the SQL Server installer, select "Advanced Options", then select "Unattended", then store the selection and configuration made by the installation into the C: /Windows/setup.iss file, the file is The unattend.iss mentioned above.

After making unattended files, the SQL can be installed automatically after executing the setup.bat file. As long as there is a way to automatically execute the content in the file in our application's installation disk, you can automatically install SQL.

Second, modify setup1.exe

For the VB engineering package, the installer except for the installation function of the application normally, and then automatically performs the unattended SQL installer we produced, and must modify the VB packaging tool. The modification method is as follows:

A, open the setup1 project under the C: / Program Files / Microsoft Visual Studio / VB98 / Wizards / PDWizard / Setup1

B, find the following statement in the exitsetup process in the Basesetup1 module:

Case intexitcod

.........

Case Else

C, add statements that mobilize SQL automatically before Case Else

D, compile into an EXE file

E, copy the compiled EXE file to the superior directory:

C: / Program Files / Microsoft Visual Studio / VB98 / Wizards / Pdwizard

Currently compiled a good program

// CHANCE-Server / Engineering Project / Installation Dish Production / Setup1

Third, make database files

Because MSDE is basic SQL SerEVER7, there must be a file name (such as: dbck) to back up the database (such as: dback) under SQL Server 7.

Four, package

A. When the project print package, the SQL automatic installer (MSDE86.EXE, UNATTEND.ISS) must be hit in the package, and the decompression path of the 2 program is specified when packaged:

$ (Winsyspath)

B, the created database backup file (DBBACK) also hits the package, and the decompression path of the file is specified when packaged:

$ (Apppath)

C, hit the application's profile, the instruction manual, etc., and specify the decompression path of the file when packaged.

$ (Apppath)

V. Installation

When the application is installed, after the standard installation step is executed, you will ask:

Do you have a database?

If you select "Yes", you automatically install SQL (don't install the machine for SQL Server).

Description: Sometimes the installer is installed under Windows2000, after copying 8 initialization programs, prompting "program outdated" requires restarting. But after restarting, the same problem is not available. At this point, modify the setup.lst file in the installation package, in:

File3=@vb6chs.dll, $ (Winsyspath), $ (Shared), 10/2/00

Increase the REM, then reinstall, only 2 files before copying, and the installer can perform smoothly.

Sixth, running procedures

After the program is installed, the database required by the application is not loaded into SQL Server. You should add the function of adding a database to SQL Server to the SQL Server to be added to the VB application we have written. Implementation method: Each time you start the application, it is judged whether there is a database we want in the SQL Server database. If you do not have it, you can do it:

1. Copy the backup file to the directory corresponding to the Master database;

2. Use the data recovery command to restore the backup files in the master directory to the specified database name.

See page:

=============== This function must be used before connecting the database =================

=============== must apply SQLDMO =======================================

Public Function ScopyMDF (SSVRNAME AS STRING, SDBNAME AS STRING, SUID AS STRING, SMDFNAME AS STRING) AS STRING

Parameter Description: SSVRNAME: Server Name

SDBNAME: Database Name

Suid: Username

SPWD: password,

SMDFNAME: Database Backup file name

DIM FSO as scripting.filesystemObject

DIM STRMESSAGE AS STRING

DIM DB AS VARIANT

Dim fdatabaseflag as boolean

DIM X, OSVR

ON Error ResMe next

ScopyMDF = ""

FDATABASEFLAG = FALSE

SET FSO = CreateObject ("scripting.filesystemObject")

Set OSVR = CreateObject ("SqldMo.sqlserver")

Osvr.connect SSVRNAME, SUID, SPWD

Osvr.Start True, SSVRNAME, SUID, SPWD

X = OSVR.DATABAS.count 'If fails, DMO needs to initialize

'Check all database names by loop on the local MSDE server,

'Check if DemoDatabase exists in this server.

For each db in osvr.databases

If DB.Name = SDBNAME TEN 'This data inventory is

fdatabaseflag = true

EXIT for 'exiting the loop

END IF

NEXT

If not fdatabaseflag life 'does not exist in Demodatabase

Dim Ostore As New SqldMo.Restore

Ostore.Action = SqldMoStore_Database

Orentore.Database = SDBNAME

Fso.copyfile app.path & "/" & smdfname, _

Osvr.databases ("Master"). PrimaryFilePath & SMDFNAME, TRUEORESTORE.FILES = OSVR.DATABASES ("Master"). PrimaryFilePath & SMDFNAME

orestore.replacedatabase = true

'Judging whether there is "C: / MSSQL7 / DATA /" directory, do not build this directory first

Ostore.sqlrestore OSVR

Else

ScopyMDF = SMDFNAME & "Exit MSDE Server"

END IF

EXITCOPYMDF:

Osvr.disconnect

SET OSVR = Nothing

EXIT FUNCTION

ScopyMDftrap:

IF err.number = -2147216399 THEN 'DMO needs to initialize

Resume next

Else

ScopyMDF = Err.Description

END IF

Resume EXITCOPYMDF

EXIT FUNCTION

END FUNCTION

转载请注明原文地址:https://www.9cbs.com/read-113371.html

New Post(0)