Why is programming interface to database called driver?

不问归期 提交于 2019-12-11 06:46:16

问题


When writing an application which updates or queries a database, we use something called a database driver (e.g. a JDBC driver). I wonder why it is called a driver instead of a library?

Is libpq a driver too?


回答1:


To quote the Wikipedia article you linked to:

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

The analogy here is that a database is an external device that the client computer "controls", by connecting to it and issuing SQL statements against it.

To continue quoting Wikipedia:

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

JDBC drivers are indeed libraries. We refer to them as drivers mostly by force of habit and convention, but it definitely isn't wrong to refer to them as libraries too.

Libpq is indeed a driver too.



来源:https://stackoverflow.com/questions/51312052/why-is-programming-interface-to-database-called-driver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!