views:

1739

answers:

4

Good morning, all. This is my first question on stackoverflow, so hopefully this isn't something that's been beaten to death and I haven't been able to find it.

I'm developing an application that is going to be distributed shrinkwrapped. We have gotten the rights to distribute SQL Server 2008 Express Edition with our application, but exactly HOW to do this is a little more difficult. Right now we're using a standard Visual Studio setup project, and I was obviously hoping for something very easy, like a configurable merge module, but obviously no such thing exists or I wouldn't be posting here ;)

The road I had started going down was to include the self-extracting EXE with our package, then use a custom install action to extract it and pass command line arguments to the SQL installer to create our named instance. Here's where the problem comes in.

Extraction is fine. I can run the script from Windows and it installs SQL Server just as it should, but I can't run the SQL installer from my custom action because it's saying that there is already another installation in progress. This other installation is, of course, my application, and it isn't going to end until SQL Server finishes, so we're essentially at a deadlock until SQL finally gives up and errors out.

What I WANT is a named instance of SQL server for my application that is installed with it and gets uninstalled with it. Writing my own installer is not an option because of time, and my coworker says InstallShield is not an option because of complexity (I've never used it, so I'll take his word for it). Does anyone have any thoughts?

A: 

One approach would be to include the SQL Server 2008 Express install package and then use a custom action in your Windows installer to fire off the silent, background installation of SQL Server 2008 Express.

The package is a standard MSI package - you should be able to set a boatload of properties on the command-line, when installing the MSI.

Here's a sample I found:

sqlexpr.exe /qb instancename="MACHINENAMESQLEXPRESS2008" 
SQLAUTOSTART=1 SAPWD="PWD" SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0"

The full list of command line properties ought to be available at Microsoft or in the help file for SQL Server 2008 Express somewhere, I'm sure.

Marc

marc_s
I've gone down this path, unfortunately. The SQL Server setup exe is actually their own custom bootstrapper that does the installation, not an MSI. However, it does install packages from several MSI's. Because my installer (MSI) is running, it can't launch it's MSI's. This, unfortunately, won't work
Adam Robinson
Dang! hmm..... if that doesn't work, I'd be out of ideas, unfortunately :-(
marc_s
+1  A: 

The code in this project is built for SQL2005, but it looks like it could pretty easily be used to deploy SQL2008.

http://www.codeproject.com/KB/applications/NET_Installer_With_SQLEXP.aspx

It also supports an instance name of your choice. It will need some tweaking for sure, but it seems to support the basic tenants of what you're trying to do.

rwmnau
Unfortunately, installing the database at runtime (the approach this article appears to take) presents two problems: the requirement of administrative rights for the user (not likely) and it provides no mechanism for removal on uninstallation :/
Adam Robinson
+1  A: 

I'm going to go ahead and answer my own question for the sake of anyone else who comes looking for this sort of information on SO...from everything that I've been able to tell, it just isn't possible to install a custom instance of SQL Server (2008 anyway, and probably 2005) that is linked to the installation of custom software without going down the road of either a custom bootstrapper or a third-party installer product (InstallShield and the like). It sounds like SQL Server Compact edition might be better suited.

Adam Robinson
A: 

Don't know if anyone is still tracking this. Perhaps you could take a look at this:

http://msdn.microsoft.com/en-us/library/dd981032(SQL.100).aspx

Haven't tried it, but am looking to solve exactly the same issue posted by Adam.

And perhaps you could use an alternative to MSI as installer:http://wai.codeplex.com/Hope it helps, please let us know how it went.Rafa.