Shop

InstallShield
Advanced Installer
AdminStudio
more / weitere

InstallShield und AdminStudio Schulungen

weitere Infos

InstallShield InstallScript: Databases

Note regarding InstallScript versions: The samples on this page have been developed with various versions of InstallShield. Some of them require a minimum InstallShield version or may only work in the one version they have been created for. Often it will be possible to make them compatible with other InstallShield versions.

Using MSDE 2000 with InstallScript Projects

This is an example of how to use the MSDE 2000 setup.exe in an InstallScript project in InstallShield DevStudio 9 for both installation and uninstallation.

Note: Your mileage may vary depending on which version of IS you use. These instructions should work with 7.0 and higher.

1) Add a new component to any feature. Call it "MSDE2000".

2) Set the destination on that component to <SUPPORTDIR>.

3) Make sure the following options on that component are set accordingly:

Shared = No
Uninstall = Yes
Self-Register = No
Potentially Locked = No
Compressed = Yes

4) Click the elipsis (...) on the Link Type option in the new component.
Select 'Dynamic Links'. Specify the path to your extracted MSDE2000 install files. Make sure you check the 'Include subfolders' box.

5) Insert the following code into OnFirstUIAfter() after ShowObjWizardPages(NEXT); :

setuppath = SUPPORTDIR ^ "setup.exe";
msdecmd = "<setup.exe options go in here>";
LaunchAppAndWait(setuppath, msdecmd, LAAW_OPTION_WAIT);
if (LAAW_PARAMETERS.nLaunchResult != 0) then
    MessageBoxEx( "MSDE 2000 failed to install.", "Install", SEVERE );
    abort;
endif;

Note: Make sure to define two new string variables in OnFirstUIAfter(): setuppath and msdecmd Also, refer to the MSDE ReadMes and Docs for the correct setup.exe options.

6) Insert the following code into OnMaintUIAfter() after ShowObjWizardPages(NEXT); :

if (UninstallMSDE == TRUE) then
    szMsg2 = IsMSDEInstalled();
    if (szMsg2 != "") then
        Enable(STATUSEX);
        SetStatusWindow(100,"Uninstalling MSDE 2000...");
        szTitle = WINSYSDIR ^ "msiexec.exe";
        szMsg1 = "/x " + szMsg2 + " /qb! REBOOTPROMPT=S";
        LaunchAppAndWait(szTitle, szMsg1, LAAW_OPTION_WAIT);
        Disable(STATUSEX);
    endif;
endif;

Note: What i've done here is created a function (IsMSDEInstalled()) that queries the registry to find the Product Code for the particular MSDE installation that was installed. You'll need this product code in order to perform an uninstallation (if that is your desire) when the whole package is uninstalled.

As well, i've set the boolean variable UninstallMSDE to TRUE only if the user selects to remove all components (i.e. a full uninstall) in the package. You can do this in the OnMaintUIBefore() function.

7) Use the following exsample to develop your own IsMSDEInstalled():

function STRING IsMSDEInstalled()
    STRING sKey;
    NUMBER nTemp, nLength;
begin 
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    if (RegDBGetKeyValueEx("SOFTWARE\\Microsoft\\Microsoft SQL Server\\INSTANCE\\Setup",
                           "ProductCode",nTemp,sKey,nLength) == 0) then 
        return sKey;
    else
        return "";
    endif;
end;

Note: You must replace INSTANCE with the particular instance name that you used in the call to setup.exe. If you didn't use an instance, consult the Microsoft KB or the MSDN Library to find out which registry key to query for the Product Code.

That's it. This should both install and uninstall MSDE 2000 wherever you'd like.

Written by Alan Lew
Last update: 2004-10-29

Get MDAC Version and Check ODBC Drivers

This script allows for checking whether MDAC is installed and which version number it is. It also allows for checking whether certain ODBC drivers are installed, including Jet, SQL Server, Oracle, FoxPro and others. This function replaces GetMDACVersion() that has been here before. The new version works by checking the key MDAC file version so it is more reliable then registry lookup, which will no longer work with Office2000 and Windows2000.

To install MDAC as quietly as possible without reboot, use the following command line.

For MDAC versions up to 2.1 (works still with 2.5):

    mdac_typ.exe /q:a /c:\"setup.exe /qn1\"

For MDAC version 2.5 and above:

    mdac_typ.exe /q:a /c:\"dasetup.exe /q /n\"

See also:
    - Information for obtaining the latest version of MDAC on the Windows Updates and Add-Ons page
    - InstallShield Object to install MDAC and DCOM

prototype GetMDACVersionFromFile (BYREF BOOL, BYREF STRING)
prototype IsODBCDriverInstalled (BYREF BOOL, STRING)

Fix: Use COMMONFILES system variable instead of hard coded path.

ZIP GetMDACnODBCVersions.zip   Written by Daniel Odievich
File size: 2.520 bytes   Last update: 2002-07-31

Install DAO 3.5 Run-Time

This script installs and registers the run-time of DAO 3.5. It includes a function that checks the version of "Oleaut32.dll" and runs "Msvbvm50.exe" (available from Microsoft) to update it, if necessary. Not included is an uninstaller for DAO.
If you need more information about DAO, you can check out Microsoft's DAO white paper (if you have VC++): Install the DAOSDK. The paper will be in the DevStudio\DAOSDK directory (daosetup.rtf). InstallShield Software Corporation has also a DAO white paper.

prototype RegisterDAO();

ZIP registerdao.zip   Written by Tyler Landas
File size: 1.631 bytes   Last revision: 03/10/1999

Installation Script for Access 97 and 2000

This is a commercial product sold by SageKey Software Inc for $375

The script adds all of the files and registry entries required to load a runtime copy of access onto a users PC and includes the same options that are available in the ODE setup wizard. The base runtime for example, without any options loads 36 files and 1097 registry entries. The package includes examples, developer notes and support.

Notes:

WWW Visit SageKey Software, Inc. to get more information

List SQL Servers

This s retrieves the names of all available SQL Servers in the current domain, and displays them in a list.

ZIP GetSQLServer.zip   Written by Sebastian Angermann, updated by Joe Baumgarten and Damien Carbery
File size: 1.922 bytes   Last update: 2003-01-12

SQL Server Database Maintenance

Here are three script functions to check whether a database exists, to create a database and to execute SQL scripts. The new version was tested with InstallShield Developer 8. The old script (also included) was created with IS6 and tested with SQL Server 7 and 2000 on Windows 2000 Server and Professional.

Updated: ExecuteSQLScript function works similar to isql and osql utilities, enabling the execution of multiple statements closed by GO, handles comments, and provides log if errors occured.

ZIP DatabaseFunctions.zip   Written by Craig E. Hohlbein, György Földvári
File size: 4.167 bytes   Last update: 2003-09-07

BDE and ODBC White Paper Hints

This chapter addresses errors and omissions in InstallShield's BDE and ODBC white papers included with InstallShield Professional 5.x or 3.x.

Installing the Borland Database Engine (Ver4.51 template for IS5.1)

Drivers.ini must be writable

This isn't really a fault in the template. Just a hint if you are using a source control system: Make sure that the file _drivers.ini in the Setup Files\Compressed Files\0009-English\Intel 32 folder doesn't have the read-only flag set. If it does, you will get the not very helpful error message "Invalid Install Path....."

Errors in BDE.H

The new BDE 4.51 template is not bad, but unfortunately it installs into the wrong place. The line in BDE.H reads

#define BDE_DEFAULT_PATH COMMONFILES ^ "Borland\\Bde"

It should be

#define BDE_DEFAULT_PATH PROGRAMFILES ^ "Borland\\Common Files\\BDE"

Also a component name is wrong in BDE.H:

#define BDE_MSSQL "BDE Files\\SQL Link Files\\MS SQL Server"

It should be:

#define BDE_MSSQL "BDE Files\\SQL Link Files\\Microsoft SQL Server"

Installing the Borland Database Engine (Ver4.x on IS3.0 and 5.x)

Error in manuals:

Adding Aliases
aliasinfo.szOptionalParams
KEYNAME=VALUE pairs should read KEYNAME:VALUE pairs

How to add other aliases:

aliasinfo.szDriverType
The driver type can be a user defined ODBC alias in addition to the ones mentioned. The easiest way to create one is using the bdeadministrator and exporting the key HKEY_LOCAL_MACHINE\SOFTWARE\Borland\Database Engine\Settings\DRIVERS\ODBC_XXXXX which can be merged during install time

Path Bug

There is a bug in the installs, in that the BDE is always installed in
C:\Program Files\Borland\Common Files\BDE

If you have a foreign language version of windows, then "Program Files" is inappropriate.
If you already have a 16bit version of the BDE on your system then you need the 32bit one in the same directory.

Quick fix: Make all your BDE components copy the files to a <BDE> directory: add this line to the end of the _BDEPreInitialization function

ComponentSetTarget(MEDIA, "<BDE>", szDefDestCfg);

ODBC 2.1 InstallShield3

Errors in the white paper and the scripts:

Page 25 in white paper - function _ConfigureODBCDriver
function prototype is missing a parameter
parameter 3 should be szODBCTargetDir

Page 26 in white paper - function _ConfigureODBCDataSource
function prototype is missing a parameter
parameter 1 should be szODBCTargetDir

ODBC.RUL
function _ConfigureODBCDataSource does not work because the string held in szDescrip is modified by a call to _GetListProfString, changing its value, causing error 401. Instead, create a local variable (e.g. szDescrip2) and use that throughout the function, instead.

DAO3.5 install

If you need to install any system files that are in use (eg COMNCTL32.DLL), then the scripts fail. The problem is that the script checks to see if any of its DLL's have failed to register, however any files that are in use will cause this to fail (They don't get registered until the machine has rebooted).  To fix this, comment out the lines inicated below, if you are sure that the DAO stuff works fine or use the ComponentError function which will tell you which file failed to selfregister.

function ISPosTransferUpdate()
NUMBER nvReturn;
begin
// Update the status bar to 100%
SetStatusWindow( 100, "" );

// Register the files, check for errors.
//if
Do ( SELFREGISTRATIONPROCESS );// < 0 then
//svISDAORegErrFileName = ERRORFILENAME;
//return ISREGISTER_ERR;
//endif;

Error in DAO.H (has been fixed in IS 5.5)

There is a type-o in "CurentVersion" (missing "r"):

#define ISDAO_REGKEY_CURRVER  "SOFTWARE\\Microsoft\\Windows\\CurentVersion"

It should be:

#define ISDAO_REGKEY_CURRVER  "SOFTWARE\\Microsoft\\Windows\\CurrentVersion"

Written by Carl Bennett, with additions from Stéphane Savariau and Wendel Leibe

 

 

 

English News Discussions Windows Installer Related Tools More Help InstallScript About InstallSite Shop Site Search
deutsch Neuigkeiten Diskussionsgruppen Windows Installer MSI FAQ Artikel     Shop Suche

Copyright © by InstallSite Stefan Krueger. All rights reserved. Legal information.
Impressum/Imprint Datenschutzerklärung/Privacy Policy
By using this site you agree to the license agreement. Webmaster contact