为什么数据库的编程接口称为 driver?

Why is programming interface to database called driver?

在编写更新或查询数据库的应用程序时,我们使用称为数据库 driver 的东西(例如 JDBC driver)。我想知道为什么它被称为 a driver 而不是图书馆?

libpq也是driver吗?

引用您链接到的维基百科文章:

In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer.

这里的类比是,数据库是客户端计算机 "controls" 连接到它并针对它发出 SQL 语句的外部设备。

继续引用维基百科:

In computer science, a library is a collection of non-volatile resources used by computer programs, often for software development.

JDBC 驱动确实是库。我们将它们称为驱动程序主要是出于习惯和约定,但将它们也称为库绝对没有错。

libpq 确实也是一个驱动程序。