简体   繁体   English

无法使用数据库时存储数据的最佳方法是什么?

[英]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.

相关问题 什么是从数据库存储和检索数据的最佳方法 - What is the best way to store and retrieve data from database 在数据库中存储堆栈跟踪的最佳方法是什么 - What is the best way to store stacktrace in database 当存储的数据和数据格式在将来的版本中可能发生变化时,存储应用程序数据的最佳方法? - Best way to store application data when data stored and data format could change in future versions? 将文本数据存储在一个或多个文件中以便可以在各种平台上使用的最佳方法是什么? - What is the best way to store text data in a file/files so it can be used in various platforms? 将 XML 数据存储到数据库中的最佳方式 - Best way to store XML data into database 将操作存储为java中的数据的最佳方法是什么? - What is the best way to store actions as data in java? 在自动化中存储执行期间使用的 sql 查询的最佳方法是什么 - What is the best way to store the sql queries used during execution in Automation 存储常用(不可更改)列表,地图的最佳方法是什么? - What is the best way to store often used (not changeable) List, Map? 什么数据结构可用于存储具有多个可比较属性的对象 - What data structure could be used to store objects with multiple comparable attributes 从HttpSession中存储/检索常用数据的最佳方法 - Best way to store/retrieve frequently used data from the HttpSession
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM