implemented database in MasterBranch

I've just added the .java files, and will add links with other classes
to next commit, so as to avoid conflicts in the future.