将数据库数据存储在文件中? [英] Storing database data in files?

查看:191
本文介绍了将数据库数据存储在文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在一个学校项目,在java,我编码的数据库应用程序。

I'm currently working on a school project, in java, and I'm coding a database application. Something like the MySQL Monitor where you type in queries and get results / whatever.

在我之前编写的应用程序中,我使用数据库来存储数据,如用户配置文件,设置等现在,显然,我不能使用数据库来存储从这个学校项目生成的数据,否则有什么意义?

In applications I've coded before, I used databases to store data, like user profiles, settings, etc. Now, obviously, I can't use a database to store data generated from this school project, otherwise what's the point?

我在考虑存储文件中的数据,但这是我现在在我的想法,我有点干运行的唯一的想法,说实话,我不想开始敲代码,然后我发现一个更好的方式做。

I'm thinking about storing the data in files but that's the only idea I have in my mind right now and I'm kinda running dry.. and to be honest, I don't want to start banging at code and then I discover a better way of doing it.

因此,如果有人知道如何存储数据(如CSV?),或者有某种数据库应用程序在内部工作的知识,一些光?

So if anyone has any idea how to store the data (like CSV?), or has some kind of knowledge of how database applications work internally, can you please shed some light?

-
编辑:为了更清楚,我不能使用数据库引擎来存储数据,我编写一个简单的数据库引擎。

-- just to be more clear, I can't use database engines to store the data, to put it this way, I'm coding a simple database engine. Ideas like what Galwegian, jkramer and Joe Skora suggested is what I'm looking for.

推荐答案

当然,你可以创建自己的数据库与文件系统,因为这是实际的数据库如何实现。例如,您可以决定将数据存储在固定或可变长度的原始数据文件中,然后创建一个单独的索引文件,其中包含指向其他文件的文件指针,以便根据您希望存储的索引信息类型为任何查询快速索引访问在您的索引文件

Sure, you could create your own database with a file system since that is how actual databases are implemented. For example, you could decide to store your data in fixed or variable length raw data files, and then create a separate index file with file pointers into that other file for quick indexed access for any queries based on what type of index information you want stored in your Index file

所以是的,看看创建2个文件 - 1来存储数据,另一个存储文件指针到那个文件,由你想要的任何索引以提供快速索引访问。

So yes, look at creating 2 files - 1 to store the data and the other to store file pointers into that file keyed by whatever indexes you are wanting to provide quick index access by.

最好的运气 - 你会来了解有关数据库建设与这个项目我很抱歉。

Best of luck - you will come to learn alot about database construction with this project I am betting.

这篇关于将数据库数据存储在文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆