# A database without using DBMS



## RBX (Jan 9, 2012)

I want to store textual encoded data in a file whose internal structure is that of a database's .

The scenario requires saving pages of a diary - one for each day (specific date). I do not want to use 3rd party softwares and want to get it done with programming language alone via file handling (or the apt method).

Could anyone enlighten me how this could be approached (Java) ?



I also need to discuss a bit of cryptography.
I maybe read something about this somewhere and since have assumed that secure systems don't store actual user passwords but use cryptographic hashing algorithm on the password and store the result. When the user re-enters password, the algorithm is applied on the input and the result of this one is matched with the one in database.

The pages I want to encode - I've thought of using DES with user's password being the deciphering key, and username and password's hash in separate plaintext database file. How feasible, secure, and efficient does this sound ?

Please speak of any errors you think in this design.

and, I know this is not as easy as I am thinking


----------



## enjoy (Jan 16, 2012)

Store it in a flat file in a simple 3 part format.
First part will tell how many bytes data you have to read
Second part can hold date
Third part will have your text data.

You can have Monthly/Yearly data files.


----------



## pranav0091 (Mar 14, 2012)

Here's one very simple way of doing it.

Write everything onto a plain file, and use a special byte-sequence to mark the end of a post.

As for the cryptography part remember that (if you are building this app just for fun, which is very likely)  then bitwise XORing is a ridiculously simple encryption procedure. 

Bitwise XOR the data-file once and you get the ciphertext-file, repeat the procedure on the ciphertext and get back your original file. As simple as that. 

*edit*
My bad, didnt notice the date...
Anyways will just let the post lie here just in case somebody finds it useful.


----------



## Faun (Mar 14, 2012)

XML..................


----------



## nims11 (Mar 14, 2012)

+1 to XML
easy to manipulate and has huge support in many languages by means of 3rd party libraries


----------



## masterkd (Mar 15, 2012)

for cryptography use md5..google a little bit, you'll find the jar file and 5-6 lines of code required to do that..really simple huh!!


----------



## gopi_vbboy (Mar 15, 2012)

xml...but as database schema gets complex,it gets complex to parse the nodes...xpath is easiest way to parse in such case...you may also use xsl to present data in web...to make it cross platform n independent of os...


----------



## doomgiver (Mar 15, 2012)

try some nosql.
like mongoDB (its humongous!)


----------



## MetalheadGautham (Mar 16, 2012)

If someone wants to avoid the overhead of a DBMS server running all the time, the best way to go about is to use SQLite3. SQLite3 offers an embedded DBMS which is inside a single file and this can be queried and data can be retrieved from this just like an ordinary DBMS and it provides all basic DBMS features.

Check this out: *stackoverflow.com/questions/41233/java-and-sqlite


----------

