Creating Installer w/ MSDE: Need to start server for OSQL

  • I have an installer package that installs MSDE, MDAC, etc for the client. I also need to run an SQL package to load the database. What I need to do is start the local MSDE so that I can run the following batch file:

    SET SQLPath=%1

    if '%SQLPath%' == '' goto pathnotok

    :pathok

    %SQLPath%\sql\msde\setup.exe

    %SQLPath%\mdac27_typ.exe

    start /wait "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqlmangr.exe" /n

    OSQL /E /i %SQLPath%\poller.sql

    OSQL /E /i %SQLPath%\sql_max_mem_size.sql

    :pathnotok

    echo "Usage: nsisqlcltools.bat <sql install path>"

    @echo off

    :endit

    The OSQL will not run after the MSDE installation unless the PC is restarted, which I am trying to avoid. The call to sqlmangr starts the manager but not the database. Is there a better way to start the database or do I need to set other flags to sqlmangr?

    Any help is appreciated.

  • This was removed by the editor as SPAM

  • You can start SQLServer service with SQL DMO as in the following VB code.

    Public Sub StartSQLService(MachineName as String)

    Dim MySqlServer as SQLDMO.SQLServer

    Set MySqlServer = New SQLDMO.SQLServer

    MySqlServer.Start False, MachineName

    End Sub

    Don't forget to add Microsoft SQLDMO object library in the Project-References dialog.

    You could probably achieve the same result in every language supporting COM objects and avoid the distribution of the VB runtime.

    Patrick

     

    Patrick Duflot

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply