[英]What is the best way to store data when a database could not be used?
I am designing a e-Diary application in which the user can store textual data EVERY DAY . 我正在设计一个电子日记应用程序,用户可以在其中每天存储文本数据 。
I thought of using a database but now I am looking for other alternatives , thought of encrypted files , but what if they get deleted ? 我曾考虑过使用数据库,但现在我正在寻找其他替代方案,想到加密文件,但是如果删除它们该怎么办?
Could someone provide me ways of doing this. 有人可以为我提供这样做的方法。
BTW, I am using Java.(If this is important). 顺便说一句,我正在使用Java。(如果这很重要)。
EDIT: Currently I am using files for acheiving this, for login I am using a file in which the username, password are stored in the format username:password , This is not a good approach, so I am looking for some secure approaches. 编辑:当前,我正在使用文件来实现此目的,登录时使用的文件中,用户名和密码以username:password格式存储,这不是一个好方法,因此,我正在寻找一些安全的方法。
Serialize your Data and store it using flatfiles. 序列化您的数据,并使用平面文件进行存储。
But why dont you want to use SQlite? 但是,为什么不使用SQlite?
Serializing and storing to the disk is a database aswell. 序列化和存储到磁盘也是一个数据库。
If you want to serialize it there are a few tutorials and code examples around. 如果要序列化,则周围有一些教程和代码示例。
check How to serialize an object into a string 检查如何将对象序列化为字符串
for example. 例如。
If you want to use a proper database (which is recommend!) you may check different databases and examples at Java and SQLite 如果要使用适当的数据库(推荐!),可以在Java和SQLite上检查不同的数据库和示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.