3

I would like to create my own database server for educational purposes. My problem is, I cannot really find information about how these systems work. Now, I can create databases and tables and get data from it with basic select statements.

But, when a client connects to the database server, how should I send the result of a query back to the client? What format should be used to get good performance? What other things may need to be taken care of, given the specific scenario?

moooeeeep
  • 31,622
  • 22
  • 98
  • 187
stomseven
  • 157
  • 1
  • 2
  • 8
  • Even simple databases are extremely advanced systems. If you want stuff like query languages or relations or transactions then it becomes a magnitude (for each feature) harder. – Some programmer dude Oct 10 '12 at 13:10
  • "My specific question is when a client connects to the database server, how should I send the result of a query back to the client?". That would depend on how you intend connecting... – Robbie Dee Oct 10 '12 at 13:12
  • 1
    @moooeeeep: Basically, he want's to know "is there something like a general JDBC/ODBC standard?" – Aaron Digulla Oct 10 '12 at 13:15
  • But a very valid question IMHO given the wider problem he is trying to solve... – Robbie Dee Oct 10 '12 at 13:15

1 Answers1

3

There are many options, depending on your needs.

JSON would allow almost any kind of client to use your database. It's also very easy to create but the format is somewhat verbose.

If you need a compact format, look at Google's Protocol Buffers which has a text (= readable) and a binary form (= compact). Many languages support protobuf but not as many as JSON (yet).

I suggest not to try to come up with your own format; there are too many already and the task looks more simple than it is. If you make a mistake, it will be hard to fix, especially when others start to use your work.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820