SQLNCLI Dependency

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • chriswies
    Indigo Rose Customer
    • Jan 2008
    • 3

    SQLNCLI Dependency

    Does anybody have a SQL 2005 Native Client dependency?
    Or how would I check if it is already installed? That would be enough for the first shot.
    How would I most rapidly create one if I never coded a setup before?
    Chris
  • jassing
    Indigo Rose Customer
    • Jan 2001
    • 3124

    #2
    Originally posted by chriswies View Post
    Does anybody have a SQL 2005 Native Client dependency?
    Or how would I check if it is already installed? That would be enough for the first shot.
    How would I most rapidly create one if I never coded a setup before?
    Chris
    What I always look for 1st is to see if there's an Uninstall entry in the registry.
    If that's not enough; you'll need to find either a windows system32 file or a reg-entry that points to a file/directory so you can evaluate the dll/exe version# 's.

    Comment

    • chriswies
      Indigo Rose Customer
      • Jan 2008
      • 3

      #3
      Uninstall-entry

      ah, sounds good.
      Can you point me to the path where I can find these entries. I'll then apply this to my driver.
      Chris

      Comment

      • jassing
        Indigo Rose Customer
        • Jan 2001
        • 3124

        #4
        Originally posted by chriswies View Post
        ah, sounds good.
        Can you point me to the path where I can find these entries. I'll then apply this to my driver.
        Chris
        Uninstall is stored in the registry.
        some where, here:
        HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uni nstall\\"

        Comment

        • chriswies
          Indigo Rose Customer
          • Jan 2008
          • 3

          #5
          As it was asked for via PM following the code we came up with at that time.

          We test against the registry "On Startup":

          Code:
          -- check for SQL Native Client (2005)
          Result = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\SQL Native Client", "Driver", true);
          if (Application.GetLastError() ~= 0) then
          	Debug.Print "SQL Native Client 2005 not installed.";	
          	Result = "";
          end
          SQLNCLIFile = Result;
          
          -- check for SQL Native Client (2008)
          Result = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\SQL Server Native Client 10.0", "Driver", true);
          if (Application.GetLastError() ~= 0) then
          	Debug.Print "SQL Native Client 2008 not installed.";	
          	Result = "";
          end
          SQLNCLI10File = Result;
          
          SessionVar.Set("%InstallNativeClient%", "true");
          SessionVar.Set("%NativeClient%", "");
          --find Native Client File
          if (File.DoesExist(SQLNCLIFile)) then
          	SessionVar.Set("%InstallNativeClient%", "false");
          	SessionVar.Set("%NativeClient%", "SQL Native Client 2005");
          end
          if (File.DoesExist(SQLNCLI10File)) then
          	SessionVar.Set("%InstallNativeClient%", "false");
          	SessionVar.Set("%NativeClient%", "SQL Server Native Client 2008");
          end


          And "On PreInstall" we install the Native Client if necessary (for the right processor architecture) - in this case, always the 2005 version is used:

          Code:
          -- Start Native Client 2005 Setup if necessary
          if (SessionVar.Expand("%InstallNativeClient%") == "true") then
          	local sqlncli_file = "sqlncli.msi"
          	if System.Is64BitOS() then
          		sqlncli_file = "sqlncli_x64.msi"
          	end
          	Param = "/I " .. String.Char(34) .. _TempLaunchFolder .. "\\" .. sqlncli_file .. String.Char(34) .. "/passive /LWAMOE c:\\install.log ALLUSERS=1";
          	Debug.Print("Temp. Setup of SQL Native Client 2005:");
          	Debug.Print(Param);
          	result = Shell.Execute(_SystemFolder .. "\\MSIEXEC.EXE", "open", Param, "", SW_SHOWNORMAL, true);
          	
          	Debug.Print("MSI Setup Result:");
          	Debug.Print(result);
          
          	-- check registry again to verify Native Client installation; Exit Setup if negative
          	Result = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\SQL Native Client", "Driver", true);
          	if (Application.GetLastError() ~= 0) then
          		Dialog.Message("Setup Error", "SQL Native Client 2005 could not be installed...", MB_OK, MB_ICONSTOP, MB_DEFBUTTON1);
          		Application.Exit(0);
          	end
          	SQLNCLIFile = Result;
          	
          	--find sqlncli exe
          	if (File.DoesExist(SQLNCLIFile)) then
          		SessionVar.Set("%NativeClient%", "SQL Native Client 2005");
          	else
          		Dialog.Message("Setup Warning", "SQL Native Client not found. Please install manually after Setup", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
          		--Application.Exit(0);
          	end
          end
          HTH,

          Chris

          Comment

          Working...
          X