How to attach Database on msde 2000 using installshield

Hi.,
I am new to installshield.  I have developed a application using VS.Net 2003. The VS.Net solution contains
1) Windows Form Project
2) Web Project
3) Class Library Project.

I am using sql server 2000 database as backend.

I have made deployment package using Installshiled X and from that i am installing MSDE 2000 on Client Machine. Upto this every goes ok.  After installation of msde 2000, i have to carry out some steps. But the MSDE service is not started.

1) While Installing MSDE i want to give name to the instance and sapassword aslo.
2) How to start MSDE 2000 service after it gets installed from installshield.
3) Attach my Database to MSDE 2000 while installation.

I want to do all this using Installshiled X

Thanks for your help in  advance,

Regards
skulldenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TOPIOCommented:
Command Line to Execute Unattended Install
The following syntax is used to install MSDE using all of the default installation settings. You must always indicate the fully qualified path to the .iss file on the command line. The following text was used to install MSDE on my laptop:


      E:\MSDE\MSDEx86.exe -s -a -f1 "E:\MSDE\unattend.iss"

As stated before, there are numerous command line switches that may be applied to the installation, but only these three were used. Notice the explanation for these as provided by MSDN:



-s Silent Mode (required for unattended installations, suppresses any installation-related windows or dialogs)
-a Append (passes any subsequent parameters to installation executable after it is unpackaged)
-fl Setup Initialization File (used to pass the path and file name of a setup initialization file)
check the full article at with many useful links
http://www.databasejournal.com/features/mssql/article.php/1494271


0
skulldenAuthor Commented:
TOPIO Thanks for the reply, But as i mentioned i want to do all these steps using Installshield. And i am not sure that what is the frive letter of the cd rom ie. E:, F: etc.

0
TOPIOCommented:
ok then from http://www.installsite.org/pages/en/isp_db.htm
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.

then you go to the section called
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.

 DatabaseFunctions.zip   Written by Craig E. Hohlbein, György Földvári

0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

skulldenAuthor Commented:
Thanks for the help...
Now i am able to install MSDE2000 by using installshiled meege modules.. the installation cof msde completes.. still no problem.. but the MSDE 2000 SQL Server Agent dose not start i have to start is manually.. else i have to reboot the machine.. to avoid restart and to start the sql server service after installation wht shall i do.. i have set all the paramaerts in a ini file.
0
TOPIOCommented:
the restart is going to be an issue what are your target os(es)
0
skulldenAuthor Commented:
Mostly it will be Windows XP Professional, windows server 2000 or windows server 2003. Really i am stuck up will this issue, the msde 2000 is getting installed properly.. but i have to stop the installation manually and then start the service manually and restart the setup again.. every time it is not possible that there will be technical person for installation.. i will be distrubuting the cd.. so how to start the nsde service after installation of MSDE 2000. plz help.

regards
0
skulldenAuthor Commented:
Hi.,
I got one script from microsoftsite to start msde 2000, after the installation of msde 2000 is finished using installshield X. Here is the script

Public Function sStartMSDE()  As String
'********************************************************************
'This subroutine will turn on MSDE. If the server has been started
'the error trap will exit the function leaving the server running
'
'Note that it will not place the SQL Service Manager on the start bar.
'
'Input:
'   sSvrName    The server to be started
'   sUID        The user used to start server
'   sPWD        The password of user
'
'Output:
'   Resolution of start
'
'References:
'   SQLDMO
'********************************************************************

    Dim osvr As SQLDMO.SQLServer

    Set osvr = CreateObject("SQLDMO.SQLServer")
    'Create the SQLDMO Server Object
       
    On Error GoTo StartError 'Error Trap
   
    osvr.LoginTimeout = 60
    'Start Server
    osvr.start True, "(local)", "sa", "mypwd"
   
    'Return results
    sStartMSDE = "SQL Server Started " 

ExitSub:
    Exit Function

StartError:
    If Err.Number = -2147023840 Then
    'This error is thrown when the server is already running,
    'and Server.Start is executed on NT
        osvr.Connect "(local)", "sa", "mypwd" 'Connect to Server
       
        'Return results
        sStartMSDE = " SQL Server Already Started"
       
    Else 'Unknown Error
        'Return results
        sStartMSDE = Err.Description
    End If
   
    Resume ExitSub
   
End Function

but i am not able to execute this script. i am trying to execute this script using the option of installshield x "Custom Actions"
wht i am missing i am not able to find.. again the same problem msde 2000 get installed but the service is not started.
regards
0
skulldenAuthor Commented:
Thanks TOPIO  for your help..
My problem is sloved. I created a custom action and started the sql server service.
Regards
0
moduloCommented:
PAQed with points refunded (125)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.