SQL Server Express LocalDB 可以远程连接吗?
我正在考虑将新的 SQL Server Express LocalDB(我认为它的代码名为Denali")用于桌面应用程序.
I am looking into using the new SQL Server Express LocalDB (I think it is code named "Denali") for a desktop application.
它当前正在运行 SQL Compact,但用户想要在网络上的多台 PC 之间共享数据库.不幸的是,这不是 SQL Compact 可以做到的,所以我正在研究其他解决方案.
It is currently running with SQL Compact, but the user is wanting to share the database between multiple PCs on a network. Unfortunately this is not something that SQL Compact can do, so I am investigating other solutions.
客户端需要能够轻松地将数据库文件发送到其他站点或将它们备份到闪存盘,因此我避免使用 SQL Express,因为备份和恢复需要相当多的管理员"知识.
The client requires the ability to send database files easily to other sites or to back them up to a flash disk, so I am avoiding going to SQL Express because there is quite a bit of "administrator" knowledge required to backup and restore.
那么,我的问题是,新的 SQL Express LocalDB 是否支持通过网络和/或通过其中包含 mdf 文件的共享网络文件夹远程连接到数据库?
So, my questions is, does the new SQL Express LocalDB support remote connections to the database over a network and/or through a shared network folder with the mdf file in it?
LocalDB 确实支持在其连接字符串 (AttachDbFileName) 中为附加的本地数据库提供路径,因此是共享网络文件夹选项.
LocalDB does support supplying a path for an attached local DB in it's connect string (AttachDbFileName) hence the shared network folder option.
注意:此问题与 SQL Express 'Denali' 的新版本LocalDB"有关,与 SQL Server Express 2008 或之前版本无关.请参阅此处发布 LocalDB 的文章:http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx
NOTE: This question pertains to "LocalDB" the new version of SQL Express 'Denali' and not to SQL Server Express 2008 or prior. See article here announcing LocalDB's release: http://blogs.msdn.com/b/sqlexpress/archive/2011/07/12/introducing-localdb-a-better-sql-express.aspx
推荐答案
不,SQL Server Express LocalDB 不接受远程连接.
No, SQL Server Express LocalDB doesn't accept remote connections.
共享网络文件夹的想法可能可行,但前提是您在尝试复制文件之前能够确保 LocalDB 实例已关闭.还要记住,只有一个 LocalDB 实例可以同时打开任何给定的数据库文件.并且不要忘记日志文件!
The idea with shared network folder might work, but only if you are able to make sure the LocalDB instance is shutdown before you try to copy the file. Also keep in mind that only one LocalDB instance can have any given database file open at the same time. and don't forget about the log files!
附加安全警告:与 SQL Server Compact 数据库不同,SQL Server Express 数据库(包括 LocalDB 数据库)并非设计为安全的数据交换格式.例如,它们可以在嵌入其中的 .NET 程序集中包含恶意代码.所以你永远不应该打开来自不受信任来源的数据库.
Additional security warning: unlike SQL Server Compact databases, SQL Server Express databases (including LocalDB ones) are not designed as secure data exchange format. For instance, they can contain malicious code in .NET assemblies embedded in them. So you should never open databases from untrusted source.
也许为客户提供一个自动执行备份过程的简单工具会是一个更好的主意?
Maybe providing the customer with a simple tool that automates the backup process would be a better idea?
相关文章