交易记录应该去哪里?平面文件或数据库
我正在开发一个 Java 企业应用程序,它需要将事务记录写入平面文件或直接写入关系数据库。交易记录是显示交易何时开始、结束、交易状态(成功/失败)以及该交易独有的数据的记录。
这些交易记录将用于生成报告。报告生成工具从数据库读取数据并生成它们。
如果使用平面文件,记录最终将加载到数据库中以生成报告。这增加了一个额外的步骤。
如果使用数据库,则不会有平面文件。我担心的是,如果数据库宕机,一些记录将会丢失。因此,这种方法不如平面文件方法安全。
所以,我无法决定。也许还有其他我没有考虑到的事情?你的看法是什么?
提前致谢。
I'm developing a Java Enterprise Application which needs to write transaction records either to flat files or directly to a relational database. Transaction records are records which show when the transaction starts, ends, transaction status (success/failure) and also data unique to this transaction.
These transaction records will then be used to generate reports. The reports generating tool reads data from a database and generates them.
If flat file is used, records will be eventually loaded into database for reports generating. This adds an extra step.
If database is used, there will be no flat file. My concern is that if database is down, some records will be missing. Thus this approach is not as secure as the flat file one.
So, I cannot decide. Maybe there are other things I didn't consider? What's your view?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您确实使用平面文件,您将需要担心锁定和刷新以及所有这些垃圾。此外,它只能存在于一个地方,如果您希望应用程序扩展,这将是一件痛苦的事情。除非停机确实是一个大问题,否则就使用数据库。
If you DO use a flat file, you'll need to worry about locking and flushing and all of that garbage. Furthermore, it can only live in one place which makes it a pain if you ever want the app to scale. Go with the database unless downtime is a REALLY big concern.