Error 1321 - Insufficient Privilages when running SQL Script
Hi Guys,
I have created in Wise Installation studio 7.0 an MSI installer which deploys a database to either C:\Program Files\Root6\Database (on 32 bit system) or C:\Program Files (x86)\Root6\Database (on 64bit system). The installer then runs an SQL Server script to attach the database:
USE master;
GO
if (SELECT SERVERPROPERTY ('Edition')) = 'Express Edition (64-bit)'
BEGIN
CREATE DATABASE objectpersistence
ON (FILENAME = 'C:\Program Files (x86)\ROOT6\Database\ObjectPersistence_Data.MDF'),
(FILENAME = 'C:\Program Files (x86)\ROOT6\Database\ObjectPersistence_Log.LDF')
FOR ATTACH;
END
ELSE
BEGIN
CREATE DATABASE objectpersistence
ON (FILENAME = 'C:\Program Files\ROOT6\Database\ObjectPersistence_Data.MDF'),
(FILENAME = 'C:\Program Files\ROOT6\Database\ObjectPersistence_Log.LDF')
FOR ATTACH;
END
GO
The script will alter the directory it looks for the database based on whether or not we detect a 64 bit instance installed.
My problem is that while this works just fine on 32Bit Windows XP, when I run it on 64Bit Windows XP, I receive the following message:
Error 1321 Windows Installer has insufficient provilages to modify this file: C:\Program Files (x86)\ROOT6\Database\ObjectPersistence_Data.MDF.
Clearly this is some for of privilage issue. I am running this on Windows XP 64but as administrator. Is there something I need to do to the ObjectPersistence_Data.MDF file after it is copied to the Program Files directory i.e. do I need to set some form of Administrators permissions on it....? If so could someone show me the correct command and parameters I should be issuing or show me how I can do this within WISE....?
Failing this, is there an alternative way to accomlish my goal...?
Many thanks,
Damien.
Comments
Check the permissions directly
OK, so are the MDF and LDF files getting installed OK - ie when you get the 1321 error, if you open Explorer and check the folder:
C:\Program Files\ROOT6\Database - are the files in there?
If they are, right click on the files and check what permissions they currently have.
There is one other thing you must bear in mind. Presumably you are running the 32 bit version of SQL Server Express on the 32 bit systems, and the 64 bit version of SQL Server Express on the 64 bit systems.
Once you start installing a 32 bit application on 64 bit systems, the 32 bit registry keys get written to the 32 bit area of the 64 bit registry. This can cause some aberrations in behaviour when a 64 bit app tries to interact with a 32 bit app due to the different parts of the registry they use.
It would be interesting to see if your app still errors out if you install 32 bit SQL on your 64 bit system.
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Normal 0 false false false EN
Hi EdT,
Thanks for your response.
Yes the MDF and LDF files are indeed deployed correctly and yes I am installing 32bit SQL Server on 32bit system and 64bit on 64 bit system.
Unfortunately I haven't had any luck installing 32bit SQL server on 64bit Windows XP, we tried this yesterday and the native client failed to install because it was incompatible.
We were unfortunately screwed then due to the appalling 2005 installer (something we have run into many times). Removing the other components of 2005 that had installed did not allow us to install the 64bit edition since it was convinced that there were components already installed even though there wasn't. We therefore paved the machine and started again.
The machine is currently busy installing updates, but I will take a look at the file permissions. I'm thinking that I may need to grant Admin privileges to the MDF and LDF files.
Out of curiosity, is there a preferred method for achieving what I am attempting to achieve...? Running SQL scripts seems a bit clunky...?
I will let you know how I get on.
Many thanks for your help so far,
Cheers,
Damien.
Permissions
As an Administrator, you should have full read-write access to all folders on the local hard disk, and I believe this is still the case on 64 bit XP builds, but once you get onto Vista and Windows 7 you are never running with full admin rights unless you "run as administrator" from the start menu.
For non-admin users, the Program File folders are read-only, so putting any content in those folders that needs write permissions is really going to cause you problems.
The correct location for such content is the <user>\Application Data folder, as the user has full write access to the folders under his/her profile.
So perhaps the simplest solution is for your installer to change location for the database files to the <user>\Application Data folder.
(The clue is in the name ;-D)
If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.
Would you like to reply?
Login or Register to post your comment.