我正在使用SQLite,所以它只是一个文件,而不是服务器,但这是计划:
I'm using SQLite so it's only a file, not a server, but here's the plan:
在网络上的一台计算机和另一台计算机上安装应用程序+物理.sqlite文件,让其他用户连接到.sqlite文件.
Install the application + the physical .sqlite file on a machine and on another machine over the network, let the other user connect to the .sqlite file.
因此,我必须共享该文件夹并为其授予权限,以允许所有人读取和写入该文件夹.
So I'd have to share that folder and give it permissions to allow everyone to read and write from it.
这是我的App.config:
Here's my App.config:
<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionStrings> <add name="ColegioMentorEntities" connectionString="metadata=res://*/Repositories.ColegioMentor.csdl|res://*/Repositories.ColegioMentor.ssdl|res://*/Repositories.ColegioMentor.msl;provider=System.Data.SQLite;provider connection string="data source=C:\Users\Sergio\Desktop\ColegioMentor.sqlite"" providerName="System.Data.EntityClient" /></connectionStrings> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" /> </startup> </configuration>似乎我可以更改连接字符串!伟大的!但是,如何在字符串中引用网络位置呢?
It seems I CAN change the connection string! Great! But how do I reference a networked location in a string?
推荐答案如建议的此处,如果需要同时支持多个用户,则可能需要考虑使用MySQL之类的东西,因为同时访问SQLite时可能会出现潜在的损坏问题.
As suggested here, you may want to consider using something like MySQL if you need to support more than a single user, due to potential corruption issues that can arise when you access SQLite concurrently.
尽管SQLite确实支持并发访问,但是您可以在其常见问题上阅读一些警告. (请参阅第5和第6项).
Though SQLite does support concurrent access, there are several caveats that you can read about on their FAQ (see items 5 and 6).
在该页面上:
在两个之间共享一个SQLite数据库 或更多Windows机器可能导致 意外的问题
sharing an SQLite database between two or more Windows machines might cause unexpected problems
更多推荐
如何为网络上的服务器提供连接字符串?
发布评论