title: 'Error -2147467259: failed to create SQL database' in WiX
body: <p>I want to create a database in the installation process using WiX 3.6. I followed many tutorials, but I think there is something I am doing wrong.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
       xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
       xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension"&gt;
  
      &lt;Product Id="{A704CA9E-2833-4276-A8A8-148F1047332F}" Name="DbInstallerTest" Language="1033" Version="1.0.0.0" Manufacturer="Microsoft" UpgradeCode="2de42bd8-acc2-48bf-b3c6-09745d3a2ea4"&gt;
          &lt;Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /&gt;
  
          &lt;MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /&gt;
          &lt;MediaTemplate /&gt;
  
          &lt;Feature Id="ProductFeature" Title="DbInstallerTest" Level="1"&gt;
              &lt;ComponentGroupRef Id="ProductComponents" /&gt;
          &lt;/Feature&gt;
      &lt;/Product&gt;
  
      &lt;Fragment&gt;
          &lt;Directory Id="TARGETDIR" Name="SourceDir"&gt;
              &lt;Directory Id="ProgramFilesFolder"&gt;
                  &lt;Directory Id="INSTALLFOLDER" Name="DbInstallerTest" /&gt;
              &lt;/Directory&gt;
          &lt;/Directory&gt;
      &lt;/Fragment&gt;
  
      &lt;Fragment&gt;
          &lt;ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"&gt;
  
              &lt;Component Id="CMPDbInsatller"
                         Guid="{1749E57D-9CE4-42F8-924C-2A2E368B51E4}"&gt;
                  &lt;CreateFolder Directory="INSTALLFOLDER"/&gt;
                  &lt;util:User Id="SqlUser"
                             Name="sa"
                             Password="Abc123@"/&gt;
              &lt;/Component&gt;
              &lt;Component Id="cmp2"
                         Guid="{C3596364-61A0-4628-9153-1BA11DB4B778}"&gt;
                  &lt;CreateFolder Directory="INSTALLFOLDER"/&gt;
                  &lt;sql:SqlDatabase Id="Id_db"
                                   Database="TestDatabase1"
                                   Server="(local)\SQLExpress"
                                   CreateOnInstall="yes"
                                   User="SqlUser"
                                   DropOnUninstall="yes"&gt;
                  &lt;/sql:SqlDatabase&gt;
              &lt;/Component&gt;
          &lt;/ComponentGroup&gt;
      &lt;/Fragment&gt;
  &lt;/Wix&gt;
  </code></pre>
  
  <p>The above code gives the following error.</p>
  
  <blockquote>
    <p>Error -2147467259: failed to create SQL database: TestDatabase1. error detail: Unknown error.</p>
  </blockquote>
  
  <p>Here is the log content,</p>
  
  <pre><code>=== Logging started: 2/18/2013  11:00:59 ===
  Action 11:00:59: INSTALL.
  Action start 11:00:59: INSTALL.
  Action 11:00:59: FindRelatedProducts. Searching for related applications
  Action start 11:00:59: FindRelatedProducts.
  Action ended 11:00:59: FindRelatedProducts. Return value 1.
  Action 11:00:59: LaunchConditions. Evaluating launch conditions
  Action start 11:00:59: LaunchConditions.
  Action ended 11:00:59: LaunchConditions. Return value 1.
  Action 11:00:59: ValidateProductID.
  Action start 11:00:59: ValidateProductID.
  Action ended 11:00:59: ValidateProductID. Return value 1.
  Action 11:00:59: CostInitialize. Computing space requirements
  Action start 11:00:59: CostInitialize.
  Action ended 11:00:59: CostInitialize. Return value 1.
  Action 11:00:59: FileCost. Computing space requirements
  Action start 11:00:59: FileCost.
  Action ended 11:00:59: FileCost. Return value 1.
  Action 11:00:59: CostFinalize. Computing space requirements
  Action start 11:00:59: CostFinalize.
  Action ended 11:00:59: CostFinalize. Return value 1.
  Action 11:00:59: MigrateFeatureStates. Migrating feature states from related applications
  Action start 11:00:59: MigrateFeatureStates.
  Action ended 11:00:59: MigrateFeatureStates. Return value 0.
  Action 11:00:59: ExecuteAction.
  Action start 11:00:59: ExecuteAction.
  Action start 11:01:01: INSTALL.
  Action start 11:01:01: FindRelatedProducts.
  Action ended 11:01:01: FindRelatedProducts. Return value 0.
  Action start 11:01:01: LaunchConditions.
  Action ended 11:01:01: LaunchConditions. Return value 1.
  Action start 11:01:01: ValidateProductID.
  Action ended 11:01:01: ValidateProductID. Return value 1.
  Action start 11:01:01: CostInitialize.
  Action ended 11:01:01: CostInitialize. Return value 1.
  Action start 11:01:01: FileCost.
  Action ended 11:01:01: FileCost. Return value 1.
  Action start 11:01:01: CostFinalize.
  Action ended 11:01:01: CostFinalize. Return value 1.
  Action start 11:01:01: MigrateFeatureStates.
  Action ended 11:01:01: MigrateFeatureStates. Return value 0.
  Action start 11:01:01: InstallValidate.
  Action ended 11:01:01: InstallValidate. Return value 1.
  Action start 11:01:01: RemoveExistingProducts.
  Action ended 11:01:01: RemoveExistingProducts. Return value 1.
  Action start 11:01:01: InstallInitialize.
  Action ended 11:01:01: InstallInitialize. Return value 1.
  Action start 11:01:01: ProcessComponents.
  Action ended 11:01:01: ProcessComponents. Return value 1.
  Action start 11:01:01: UnpublishFeatures.
  Action ended 11:01:01: UnpublishFeatures. Return value 1.
  Action start 11:01:01: UninstallSqlData.
  Action ended 11:01:02: UninstallSqlData. Return value 1.
  Action start 11:01:02: RemoveFiles.
  Action ended 11:01:02: RemoveFiles. Return value 0.
  Action start 11:01:02: RemoveFolders.
  Action ended 11:01:02: RemoveFolders. Return value 1.
  Action start 11:01:02: CreateFolders.
  Action ended 11:01:02: CreateFolders. Return value 1.
  Action start 11:01:02: ConfigureUsers.
  Action start 11:01:02: CreateUserRollback.
  Action ended 11:01:02: CreateUserRollback. Return value 1.
  Action start 11:01:02: CreateUser.
  Action ended 11:01:02: CreateUser. Return value 1.
  Action ended 11:01:02: ConfigureUsers. Return value 1.
  Action start 11:01:02: InstallFiles.
  Action ended 11:01:02: InstallFiles. Return value 1.
  Action start 11:01:02: InstallSqlData.
  Action start 11:01:19: CreateDatabase.
  Action ended 11:01:19: CreateDatabase. Return value 1.
  Action ended 11:01:19: InstallSqlData. Return value 1.
  Action start 11:01:19: RegisterUser.
  Action ended 11:01:19: RegisterUser. Return value 1.
  Action start 11:01:19: RegisterProduct.
  Action ended 11:01:19: RegisterProduct. Return value 1.
  Action start 11:01:19: PublishFeatures.
  Action ended 11:01:19: PublishFeatures. Return value 1.
  Action start 11:01:19: PublishProduct.
  Action ended 11:01:19: PublishProduct. Return value 1.
  Action start 11:01:19: InstallFinalize.
  CreateDatabase:  Error 0x80004005: failed to create to database: 'TestDatabase1', error:
  
  unknown error
  Error 26201. Error -2147467259: failed to create SQL database: TestDatabase1, error detail:
  
  unknown error.
  MSI (s) (94!44) [11:01:47:973]: Product: DbInstallerTest -- Error 26201. Error -2147467259:
  
  failed to create SQL database: TestDatabase1, 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 11:01:47: InstallFinalize. Return value 3.
  Action ended 11:01:48: INSTALL. Return value 3.
  Action ended 11:01:48: ExecuteAction. Return value 3.
  Action ended 11:01:48: INSTALL. Return value 3.
  === Logging stopped: 2/18/2013  11:01:48 ===
  MSI (c) (C0:94) [11:01:48:208]: Product: DbInstallerTest -- Installation failed.
  
  MSI (c) (C0:94) [11:01:48:209]: Windows Installer installed the product. Product Name:
  
  DbInstallerTest. Product Version: 1.0.0.0. Product Language: 1033. Manufacturer: Microsoft.
  
  Installation success or error status: 1603.
  </code></pre>
  
  <p>What am I doing wrong here?</p>