Hi, When SQL Server creates the database files in the O/S it does so using the identity of the SQL Server Service, the Service identity does not have access to your program files area.
I suspect you will have big issues trying to create the database in My Documents for this reason. If you are using SQL 2005 or later then the service identity for SQL Server is most likely Network Service (or could be a named user), neither of these is likely (and neither should they) have access to a specific My Documents area. My suggestion is one of three 1. Define a particular shared area where the database will be created, create that folder yourself and then apply appropriate security to that folder, so that the SQL Service account can write to it. SQL Server may setup a special local group that you could use - but I have not checked this out. 2. Just let SQL Server set the default path (and assume someone knowledgeable is setting this correctly) - this is my recommendation especially if you are doing server software setup. 3. Do you have some control over the SQL Install - if so pre configure it to have a different default data and log file location, SQL Server install will then deal with the appropriate permissions and your installer can just ride on the back. This option would be good if you are doing some sort of pre-packaged SQL Express install). Regards Michael -----Original Message----- From: Crusty Applesniffer [mailto:crusty.applesnif...@free.fr] Sent: Monday, 31 August 2009 7:31 PM To: wix-users@lists.sourceforge.net Subject: [WiX-users] SQLExtension create database and access denied error Hello, I'm trying to define a new SQL database using Wix, that has its files (MDF and LDF) in a specific folder (ideally in the user's documents and settings, but this is another story) The thing is when I use the snippet : <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="$(var.PlatformProgramFilesFolder)"> <Directory Id="MANUFACTURERFOLDER" Name="MyCompany" > <Directory Id="INSTALLDIR" Name="MyApp"> . <Component Id='SqlComponent' Guid='1324BB67-2DAE-4676-9066-B87326299BE5' Win64="$(var.Win64)" KeyPath ='yes'> <util:User Id='SQLUser' Name='[ACCOUNT]' Password ='[PASSWORD]' /> <sql:SqlDatabase Id='SqlDatabase' Database='MyDatabase' ConfirmOverwrite='yes' Server='.' CreateOnInstall='yes' DropOnUninstall='no' ContinueOnError='no' Instance='SQLEXPRESS' > <sql:SqlFileSpec Id="Mdf" Name="MyDatabase" Filename="[INSTALLDIR]MyDatabase.mdf" Size="4MB" GrowthSize="2MB"/> <sql:SqlLogFileSpec Id="Ldf" Name="MyDatabase_log" Filename="[INSTALLDIR]MyDatabase_log.ldf" /> <sql:SqlScript Id='CreateTable' BinaryKey='CreateTable' ExecuteOnInstall='yes' /> </sql:SqlDatabase> </Component> I get the following error when launching the MSI file CreateDatabase: Error 0x80040e14: failed to create to database: 'MyDatabase', error: CREATE FILE encountered operating system error 5(Access denied.) while attempting to open or create the physical file 'C:\Program Files (x86)\MyCompany\MyApp\MyDatabase.mdf'. I'm using Vista 64 bits and the MSI file is a 32bits one (but I've got the same when using the 64bits one) I wonder if there is a way to create theses files (mdf and ldf) in a folder that is not the default one (C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data) Thank you Crusty Applesniffer ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ WiX-users mailing list WiX-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wix-users