I'm trying to install a database with WIX.
I've already installed SQL Server 2008 express on my Windows7 (32 Bit). On this installation, TCP/IP is enabled, SQL Server service is running.
I'm using SQL Server and Windows authentication for SQL Server. I tried both in the code - I added a user in the component.
The code is very basic :
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension">
<Product Id="*" Name="NewDatabaseInstaller" Language="1033"
Version="1.0.0.0" Manufacturer="My Company"
UpgradeCode="17ef693b-3ab5-4788-a6b5-70eeabc13497">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="NewDatabaseInstaller" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
</Product>
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="NewDatabaseInstaller" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="cmpSqlDatabase" Guid="{F950605D-AA59-43E6-AB19-9452F6BEC649}" KeyPath="yes">
<sql:SqlDatabase Id="sqlDatabase_MyDatabase" Server="localhost"
Instance="MSSQLSERVER" Database="MyDatabase"
CreateOnInstall="yes" DropOnUninstall="yes"
ContinueOnError="no" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
I had the instance name by taping this query in the Management studio :
SELECT @@servicename
However, I get an error :
CreateDatabase: Error 0x80004005: failed to create to database: 'MyDatabase', error: unknown error
Error 26201. Error -2147467259: failed to create SQL database: MyDatabase, error detail: unknown error.
MSI (s) (FC!74) [17:43:27:786]: Product: Test -- Error 26201. Error -2147467259: failed to create SQL database: MyDatabase, error detail: unknown error.CustomAction CreateDatabase returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
Action ended 17:43:27: InstallFinalize. Return value 3.
Did I miss something?
Thanks !
<util:User Id='sa' Name='sa' Password='password' />
and updated sql:SqlDatabase with the user. I tried to log in management studio on localhost with the user sa. I can log in and run queries but I still have the error. Users (my local user and sa user have the sysadmin role) – Bob