使用共享文件作为数据库

发布于 2024-10-10 06:41:16 字数 487 浏览 0 评论 0原文

作为我的数据库类的项目,我构建了一个简单的面向对象的数据库(用 C++ 编码)。数据库通过使用网关文件来管理并发性,该文件授予对整个数据库的读/写访问权限。要跨不同计算机访问同一数据库,可以使用共享文件夹。

我在此基础上构建了一个小测验应用程序。在具有多个用户的单个系统以及我家的 3 台计算机网络上,一切都运行良好。但是当它在我大学的网络上运行时,我不断收到不一致的数据损坏,其形式为错误的 CRC(在我的数据库中,而不是磁盘中)、文件头与文件数据不一致以及其他奇怪的错误,而我无法解决这些问题追查。 网络存在问题 - 有时网络上的某些节点无法访问,有时跨网络复制文件需要花费大量时间。

有时,我会收到错误消息“Windows 延迟写入失败”,因此我认为问题是由网络上的文件共享问题引起的。从一些分析来看,数据似乎正在被缓存,所以我不知道真正知道磁盘写入是否成功。

有人有使用共享文件作为数据库的经验吗?我想知道使用共享文件是否可靠,以及我是否应该将代码中的错误视为问题的原因。

谢谢。

As a project for my database classes, I built a simple object-oriented database (coded in C++). The DB manages concurrency by using a gateway file, which grants read/write access to the entire DB. To access the same DB across different machines, you use shared folders.

I built a little quizzing application on top of that. Everything works fine on a single system with multiple users as well as on a 3 computer network on my home. But when its run on my University's network, I keep getting inconsistent data corruption in the form of bad CRCs (in my database, not the disk), file headers being inconsistent with file data, and other weird errors, which I'm unable to track down.
The network is problematic - sometimes some nodes on the network become unreachable, and sometimes copying a file takes across the n/w takes an inordinate amount of time.

Occasionally, I get an error message 'Windows delayed write failed', so I'm thinking the problems are being caused by problems with file sharing across the network. From some analysis its seems that data is being cached, and so I don't know really know whether a disk write is successful.

Does anyone have any experience in using shared files as databases? I want to know whether using shared files is reliable, and whether I should be looking at bugs in my code as the cause of the problems.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

淡淡的优雅 2024-10-17 06:41:16

不,这不可靠。这就是 CVS 禁用使用共享文件作为存储库的模式的原因。解决方案是创建一个服务器(例如,一个简单的 TCP/IP 服务器)。

No, it's not reliable. It was the reason why CVS disabled mode that used shared files for repository. The solution is to create a server (e.g. a simple TCP/IP server).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文