简体   繁体   中英

Building a database structure in java and save files in XML format

I am new to Java and I am working on a project called ( in-memory database server ). In this project I am supposed to build the database structure for the tables and the relations between them ( I am not going to use any DB language, I should build the structure by myself ), and then save these structures to XML files in the server ( It's a fixed schema of three tables ), next I am supposed to handle the CRUD operations on the saved data sent from clients over sockets to the DB-server(using TCP). Also I must use a caching method to access the data fast from memory instead of the HDD.

Well, when thinking in the project generally I see it very complex and I don't know from where to start! Should I start with the client or the server? I tried to divide the problem into smaller problems so I have these question that I need answers to it in order to catch the starting point.

  • How can I build the tables and save them in XML files?
  • After building the tables' structures, how can I make the relations between the tables? (The primary keys,foreign keys, and else).
  • How will client and server communicate to handle the CRUD operations?
  • What is the best caching method and how can I implement it.

I want to start building "Users" table, the client has a GUI Login form that will send the username and password to the server, the server will check them and log the user in.

I know it's a lot of questions, but I need help to understand how the work will be done, I need useful topics and videos, any related link may help me.

I would start by trying to define one of the tables in XML format. Probably starting with an XML Schema definition about the format the XML will take in the "table definition" file(s). Once I had that ready, I would start unit testing the heck out of that/those XML. Only after I had everything working to my satisfaction in the unit testing stage would I introduce any complexity of the web client/server variety. Baby steps win.

EDIT: (Useful links: Google this: "XML Schema definition example")

You're new to Java, and you haven't written a database management system before. You've got quite a learning curve ahead of you. Breaking the problem down into manageable chunks is very wise. I'd start reading about principles of DBMS (independent of any implementation language), and then maybe download some open source Java DBMS and study how others have solved the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM