Create a client-server database without using JDBC-ODBC or other SQL connections. Be able to read and write to a single table, one record at a time. Can be application or applet.
Posted on 2004-11-08
Intermediate to Advanced Level: Create a client server – database without using JDBC-ODBC
i am trying to implement the server code and client code for a custom-database program. I have to implement my own server-client java program and implement it without using JDBC ODBC etc (or other SQL databases). I know how to do it using JDBC connection but I have no clue on how to work with my own file (creating both server side code and client side code), the table of the database should be stored in one file.
Requirements and Limitations:
1) The database should be included in 1 file holding the data for a single table.
2) The file should have fixed-length records and should use only simple data types: number, char etc
3) implement a Java class accessing this file for writing and reading.
4) Functionality: displaying the contents of a table and modifying, deleting or adding specific records in the table
5) The data should be read or written in the data file using: an iterator pattern (the server java program should be able to work on a single record of the data file when it’s called by the client program – I should not read the whole file into memory. I think a good idea is to use java.io.RandomAccessFile to accomplish this.
6) the program can be written as an application or as an applet.
7) I have to handle exceptions as well, (including exceptions similar to ODBC exceptions regarding duplicate keys, etc.
8) The client and server program does not need to implement SQL queries. Just displaying the whole table and be able to add, remove and modify a specific line-record.
I would really appreciate any help on this. Especially with the server side part I have no idea how to do it. Please help me as much as you can, either full code for both client and server or parts of code from client and server.
Thank you in advance!