我们在哪里使用 JDBC,它有什么特别之处?

where do we use JDBC and what is so special about it?

如果我们可以通过在 postgresql pg3admin 中编写查询并执行它来直接使用 sql 查询获取所有数据,那么 为什么我们需要使用 JDBC 用于请求数据。明确地说,我们在实践中在哪里使用 JDBC ?

JDBC 的目标是为连接不同的 DBMS-es 提供标准接口。

SQL 的目标是提供一种标准语言,可用于编写跨多个 DBMS 的可移植查询。

所以直接比较的就是苹果和橘子。但是从开发人员的角度来看,您可以说 JDBC 是一种连接到数据库服务器的方式,SQL 是指示数据库服务器执行实际工作的方式。

wikipedia所说

JDBC is a Java database connectivity technology (Java Standard Edition platform) from Oracle Corporation. This technology is an API for the Java programming language that defines how a client may access a database. It provides methods for querying and updating data in a database. JDBC is oriented towards relational databases. A JDBC-to-ODBC bridge enables connections to any ODBC-accessible data source in the JVM host environment.

同一个维基百科说 SQL

SQL Structured Query Language[6][7][8][9]) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS).

我认为这两个陈述足以表达差异,但在 外行 术语中

SQL is a standardized query language for requesting information from a database

主要用来操作数据库中的数据

其中

(JDBC) is an application program interface (API) specification for connecting programs written in Java to the data in popular databases.

用于为您的java应用程序提供访问数据库的桥梁,然后使用SQL操作数据