iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 25
2
Software Development

Let's build a DBMS: StellarSQL -- a minimal SQL DBMS written in Rust系列 第 25

StellarSQL 24: Different Client Design of DBMS

24: Different Client Design of DBMS

2018/11/8

It's recommended to read on Gitbook

When you want to fetch the DBMS, you would need a client. A client could be a user interface application, or embed in programs written in JS, C++, JAVA, ect.

In earlier times, the DBMS is really simple. There is just a DBMS and a client on the same device. When a program want to connect and manipulate a DBMS, it could use functions or macro.

the code might look like:

macro sql

As you can see, EXEC SQL is the macro, and the program could call the DBMS.

This design is old-fashioned, but still could be seen at embedded device, which runs a local DBMS.

The more modern way of design would like:

String conUrl = "jdbc:sqlserver://portNumber:1234;serverName=test;databaseName=test_db;user=tester;password=12345;";
Connection connection = DriverManager.getConnection(conUrl);

try {
    String sql = "SELECT user_id FROM user_table";
    Statement stmt = connection.createStatement();

    ResultSet rs = stmt.executeQuery(sql); // query result
    ResultSetMetaData rsmd = rs.getMetaData(); // get data from query

    // ...
}

The biggest improvement is not the object-oriented design, but rather the concept of connection. In this design, the connection needs to set the ip, port, and the server name, which means there are more than one DBMS the program could reach for. In other words, there are more data and servers in the age of this design becoming to be used.

In the end, advance in technology, there will be more and more high level designs of DBMS and clients for big data and distributed system being being created and adopted.


Quick Link
1.StellarSQL Repository
2.Gitbook of this series

Author
Liu, An-Chi (劉安齊). A software engineer, who loves writing code and promoting CS to people. Welcome to follow me at Facebook Page. More information on Personal Site and Github.


上一篇
StellarSQL 23: Implement Table `insert`
下一篇
State Machine
系列文
Let's build a DBMS: StellarSQL -- a minimal SQL DBMS written in Rust30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言