如何为网络上的服务器提供连接字符串?

编程入门 行业动态 更新时间:2024-10-23 08:39:23
本文介绍了如何为网络上的服务器提供连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用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=&quot;data source=C:\Users\Sergio\Desktop\ColegioMentor.sqlite&quot;" 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

更多推荐

如何为网络上的服务器提供连接字符串?

本文发布于:2023-10-30 22:45:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1544216.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:字符串   何为   服务器   网络

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!