使用引导的 SQL Express 创建数据库
我编写了一个应用程序,它使用 Wix 3.5 安装程序引导 SQL Express 2008,然后尝试在首次运行该应用程序时创建数据库。因此,SQL Express 的安装是完全无人值守的。当安装应用程序的帐户是计算机上的管理员时,这一切都可以正常工作。
然而,毫不奇怪的是,以非管理员身份安装时会出现问题。当我们尝试运行 CREATE DATABASE sql 时,它会发出声音 -
sql express 2008 在数据库“master”中创建数据库权限被拒绝
显然标准用户帐户没有正确的权限。因此,我们需要以某种方式授予标准用户正确的权限。我曾考虑过捆绑一个单独的可执行文件,该可执行文件被迫以管理员身份运行(通过 UAC),这将创建数据库并将新数据库的权限分配给用户帐户 - 这不是一个非常优雅的解决方案。
这似乎是部署应用程序时您想要做的显而易见的事情,但似乎缺乏有关该主题的信息。寻找建议 - 谢谢。
I've written an app which bootstraps SQL Express 2008 with a Wix 3.5 installer, then attempts to CREATE DATABASE on first run of the app. The install of SQL Express is thus totally unattended. This all works fine when the account installing the app is an Administrator on the machine.
However, somewhat unsurprisingly, problems arise when installing as non-admin. When we try to run CREATE DATABASE sql it squarks -
sql express 2008 create database permission denied in database 'master'
Obviously the standard user account doesn't have the correct privilege. So somehow we need to grant the standard user the correct privs. I have thought of bundling a separate executable which is forced to run as Admin (via UAC) which would create the database and assign privileges on the new database to the user account - not a very elegant solution.
This seems like an obvious thing you'd want to do when deploying an app but there seems to be a dearth of information on the subject. Looking for suggestions - thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明,您可以使用 WiX 和 SQL 扩展来完成所有这些工作。
http://www.tramontana.co.hu/wix/lesson7.php# 7.1
Turns out you can do all of this with WiX, with the SQL Extension.
http://www.tramontana.co.hu/wix/lesson7.php#7.1
安装应用程序时,一个相当常见的先决条件是,您需要成为安装该应用程序的计算机的管理员。为什么你不能把它作为先决条件呢?大多数系统管理员无论如何都不希望他们的非管理员用户安装应用程序。
It is a fairly usual prequisite that when installing an app, you need to be an administrator on the machine you are installing it. Why can you simply not make it a prequisite? Most sysadmins don't want their non admin users installing apps anyway.