[wix-users] DB not getting created in Program Files (x86) folder

Edwin Castro egcastr at gmail.com
Wed Aug 15 08:45:11 PDT 2018


I have very limited experience with SqlDatabase so take everything I say
with a grain of salt.

First, the database will be created at [SQL_SERVER_INSTANCE] which could be
a different, remote system than the one where the MSI was installed
depending on user input. If the target server is indeed a different, remote
system, then [INSTALLFOLDER] will not exist on that remote system since the
folder will only be created locally on the system where the MSI was
installed.

Next, assuming the MSI is installed on the same system where SQL Server is
installed, then the mdf and ldf files are not created by WiX or the Windows
installer. Rather they are created by the service account under which that
SQL Server instance is running. You'd need to ensure that particular user
is given appropriate permissions probably GenericAll (but check the SQL
Server documentation for requirements) using util:PermissionEx. Of course
you'll need to be told which user is running the SQL Server instance. Note
I'm talking about the service account you see listed in services.msc and
not the user you use to connect to the SQL Server instance.

Again, none of this matters if your dealing with a remote system and
Windows Installer won't help you with remote systems. You'd have to create
your own custom actions to create the folder on the remote system as well
as assign any required permissions.

I don't know if this matters but you have Name="tpLog.mdf" for the ldf file
instead of Name="tpLog.ldf".

Back in the day, when I automated database installs and upgrades, we used
PowerShell to automate the various actions required instead of using MSI.
We considered very briefly to install the database automation with MSI but
quickly decided that didn't actually provide us any value as the automation
could be used from any system that had network access to SQL Server. We
couldn't install the MSI on the SQL Server instance so it didn't make sense
to "install" a database MSI on a system that didn't have the database on
it...

--
Edwin G. Castro


On Wed, Aug 15, 2018, 04:58 Ven H <venh.123 at gmail.com> wrote:

> Please find the Product.wxs below.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <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">
> <Product Id="8EFD525A-303F-4836-8D64-2A0EEB982AA2" Name="DBPathSample"
> Language="1033" Version="1.0.0.0" Manufacturer="DB_PATH_SAMPLE"
> UpgradeCode="ebd87ab3-1834-4b6e-a473-86d61d3d5334">
> <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"
> />
>
> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is
> already installed." />
> <MediaTemplate EmbedCab="yes" />
>
>     <Property Id="MSIUSEREALADMINDETECTION" Value="1" />
>     <Property Id="MSIFASTINSTALL" Value="1"/>
>     <Property Id="MsiLogging" Value="v" />
>     <Property Id="MSIENFORCEUPGRADECOMPONENTRULES" Value="1" />
>
>     <Property Id="SQL_SERVER_INSTANCE" Value="MySQLServer"/>
>     <Property Id="SQL_LOGIN_NAME" Value="Admin"/>
>     <Property Id="SQL_LOGIN_PASSWORD" Value="AdminPwd"/>
>
> <Feature Id="ProductFeature" Title="DBPathSample" Level="1">
> <ComponentGroupRef Id="ProductComponents" />
> </Feature>
> </Product>
>
> <Fragment>
> <Directory Id="TARGETDIR" Name="SourceDir">
> <Directory Id="ProgramFilesFolder">
> <Directory Id="INSTALLFOLDER" Name="DBPathSample" />
> </Directory>
> </Directory>
> </Fragment>
>
> <Fragment>
>     <util:User Id="SQLUser" Name="[SQL_LOGIN_NAME]"
> Password="[SQL_LOGIN_PASSWORD]" />
> <ComponentGroup Id="ProductComponents">
> <Component Id="dbComp1" Guid="2D846C0A-BD4C-47C8-9D67-3B749DD32180"
> Directory="INSTALLFOLDER" KeyPath="yes">
>         <sql:SqlDatabase Id="msiTestDB1" Database="Test_Path_DB"
> Server="[SQL_SERVER_INSTANCE]" CreateOnInstall="yes" User="SQLUser" >
>
>           <sql:SqlFileSpec Id="tpDataFile"
> Filename="[INSTALLFOLDER]tpData.mdf" Name="tpData.mdf" Size="3072KB"
> MaxSize="10MB" GrowthSize="10%"/>
>           <sql:SqlLogFileSpec Id="tpLogFile"
> Filename="[INSTALLFOLDER]tpLog.ldf" Name="tpLog.mdf" Size="2048KB"
> MaxSize="10MB" GrowthSize="10%"/>
>         </sql:SqlDatabase>
>       </Component>
> </ComponentGroup>
> </Fragment>
> </Wix>
>
> Error in the Log below.
>
> Line 502: CreateDatabase:  Error 0x80004005: failed to create to database:
> 'Test_Path_DB', error: unknown error
> Line 505: Error 26201. Error -2147467259: failed to create SQL database:
> Test_Path_DB, error detail: unknown error.
> Line 506: MSI (s) (E4!2C) [04:42:40:308]: Product: DBPathSample -- Error
> 26201. Error -2147467259: failed to create SQL database: Test_Path_DB,
> error detail: unknown error.
>
> This won't be due to space since there is more than 2 GB space in that
> drive. I have other similar samples where DB gets created in other folders,
> which also rules out the possibility of issues with SQL settings. Hence I
> came to the conclusion that it may be a permission issue.
>
>
>
>
> On Tue, Aug 14, 2018 at 12:03 AM, Edwin Castro <egcastr at gmail.com> wrote:
>
>> Let's begin with:
>>
>> what is your wix authoring for this?
>> what is the actual error in log?
>> what specifically leads you to believe it is a permission issue?
>> what have you tried to resolve the suspected permission issue?
>>
>> --
>> Edwin G. Castro
>>
>>
>> On Mon, Aug 13, 2018 at 9:45 AM, Ven H via wix-users <
>> wix-users at lists.wixtoolset.org> wrote:
>>
>>> When I give the path for creating the DB (data and log files) in Program
>>> Files (x86) folder in my MSI, I always get an error in the log, which is
>>> not so helpful for troubleshooting. Initially, I thought, this could be
>>> due
>>> to space, but tried on a server with lots of space, but there also, I get
>>> the same issue. Upon some searching I found that it is because of
>>> permission, but I am not sure how to fix it. Can anyone please help?
>>>
>>> ____________________________________________________________________
>>> WiX Toolset Users Mailing List provided by FireGiant
>>> http://www.firegiant.com/
>>>
>>
>>
>



More information about the wix-users mailing list