From Database Management Systems, by Raghu Ramakrishnan, Johannes Gehrk
来自数据库管理系统,由Raghu Ramakrishnan,Johannes Gehrk撰写
ODBC and JDBC achieve portability at the level of the executable by introducing an extra level of indirection. All direct interaction with a specific DBMS happens through a DBMS-specific driver. A driver is a software program that translates the ODBC or JDBC calls into DBMS-specific calls. Drivers are loaded dynamically on demand since the DBMSs the application is going to access are known only at run-time. Available drivers are registered with a driver manager.
ODBC和JDBC通过引入额外的间接级别在可执行级别实现可移植性。与特定DBMS的所有直接交互都通过DBMS特定的驱动程序进行。驱动程序是一种软件程序,可将ODBC或JDBC调用转换为特定于DBMS的调用。驱动程序是按需动态加载的,因为应用程序要访问的DBMS仅在运行时才知道。可用的驱动程序已向驱动程序管理器注册
One interesting point to note is that a driver does not necessarily need to interact with a DBMS that understands SQL. It is sufficient that the driver translates the SQL commands from the application into equivalent commands that the DBMS understands. Therefore, in the remainder of this section, we refer to a data storage subsystem with which a driver interacts as a data source.
需要注意的一点是,驱动程序不一定需要与理解SQL的DBMS进行交互。驱动程序将SQL命令从应用程序转换为DBMS可以理解的等效命令就足够了。因此,在本节的其余部分中,我们将引用一个数据存储子系统,驱动程序与该数据存储子系统作为数据源进行交互。
-
"A DBMS-specific driver translates ODBC or JDBC calls into DBMS-specific calls." What does "DBMS-specific calls" mean here? Are they SQL statements?
“DBMS特定的驱动程序将ODBC或JDBC调用转换为特定于DBMS的调用。” “DBMS特定呼叫”在这里意味着什么?它们是SQL语句吗?
-
"A driver translates SQL commands from the application into equivalent commands that the DBMS understands."
“驱动程序将SQL命令从应用程序转换为DBMS理解的等效命令。”
-
What does "equivalent commands that the DBMS understands" mean here? Are they SQL statements?
“DBMS理解的等效命令”在这里意味着什么?它们是SQL语句吗?
-
What is the SQL dialect that are used by the applications which use JDBC API? Is it the same as or very close to the standardized SQL, because it can't be the SQL dialects used in MySQL, PostgreSQL, SQL Server, or Oracle Database ?
使用JDBC API的应用程序使用的SQL方言是什么?它是否与标准化SQL相同或非常接近,因为它不能是MySQL,PostgreSQL,SQL Server或Oracle数据库中使用的SQL方言?
-
-
"a driver does not necessarily need to interact with a DBMS that understands SQL."
“驱动程序不一定需要与理解SQL的DBMS交互。”
- Can a JDBC driver work with relational databases that understand a different language from SQL?
- Can a JDBC driver work with nonrelational databases (so with a different language from SQL)?
JDBC驱动程序是否可以与理解与SQL不同的语言的关系数据库一起使用?
JDBC驱动程序可以与非关系数据库一起使用(因此使用与SQL不同的语言)吗?
2 个解决方案
#1
1
"Calls" here is shorthand for "API calls", within which SQL statements might be passed. "SQL commands" is synonymous with "SQL statements".
这里的“调用”是“API调用”的简写,可以在其中传递SQL语句。 “SQL命令”与“SQL语句”同义。
A JDBC driver takes in JDBC API (typically DBMS-agnostic) calls from a Java app, and emits DBMS-specific API calls to the DBMS. An ODBC driver takes in ODBC API (typically DBMS-agnostic) calls from a C app, and emits DBMS-specific API calls to the DBMS (often, but not always, to the DBMS "native" network client libraries).
JDBC驱动程序从Java应用程序接收JDBC API(通常是DBMS不可知)调用,并向DBMS发出特定于DBMS的API调用。 ODBC驱动程序从C应用程序接受ODBC API(通常是DBMS不可知)调用,并向DBMS发出DBMS特定的API调用(通常但不总是向DBMS“本机”网络客户端库)。
There are cases where the ODBC and JDBC standards provide special syntax for SQL which varies wildly across DBMS. The app emits a standard-compliant special bit of SQL syntax, which the DBMS-specific driver translates from that DBMS-agnostic SQL dialect into the DBMS-specific dialect of the target DBMS. (example ODBC section, example JDBC section)
在某些情况下,ODBC和JDBC标准为SQL提供了特殊的语法,这些语法在DBMS之间变化很大。该应用程序发出符合标准的特殊SQL语法,DBMS特定的驱动程序将该DBMS不可知的SQL方言转换为目标DBMS的DBMS特定方言。 (示例ODBC部分,示例JDBC部分)
#2
1
A DBMS-specific call means that the driver translates your calls of the JDBC API to calls to the API on the database server (likely different, maybe even very different). For example, calling Connection.createStatement()
might translate to a call to the server with a command allocateStatement
特定于DBMS的调用意味着驱动程序将您对JDBC API的调用转换为对数据库服务器上的API的调用(可能不同,甚至可能非常不同)。例如,调用Connection.createStatement()可能会转换为使用命令allocateStatement对服务器的调用
Equivalent commands here means, that a driver could parse your SQL and translate this to a totally different query language, or maybe even to low-level commands that the database understands. As an example, consider JDBC or ODBC drivers that allow you to query an excelsheet. Excel itself does not understand SQL.
这里的等效命令意味着,驱动程序可以解析您的SQL并将其转换为完全不同的查询语言,甚至可以转换为数据库理解的低级命令。例如,考虑允许您查询excelsheet的JDBC或ODBC驱动程序。 Excel本身不了解SQL。
Another example, one of the predecessors of Firebird had its own query language (this is before SQL was standardized), that was always compiled down to low-level commands. When they initially added support for (dynamic) SQL, this was purely implemented in the client driver. This client driver would parse and compile SQL statements to the same low-level commands, which would then be sent to the server. The server did not understand SQL, and instead it received 'equivalent commands' that it did understand.
另一个例子,Firebird的前身之一有自己的查询语言(这是在SQL标准化之前),它总是被编译成低级命令。当他们最初添加对(动态)SQL的支持时,这纯粹是在客户端驱动程序中实现的。此客户端驱动程序将SQL语句解析并编译为相同的低级命令,然后将这些命令发送到服务器。服务器不理解SQL,而是接收到它理解的“等效命令”。
#1
1
"Calls" here is shorthand for "API calls", within which SQL statements might be passed. "SQL commands" is synonymous with "SQL statements".
这里的“调用”是“API调用”的简写,可以在其中传递SQL语句。 “SQL命令”与“SQL语句”同义。
A JDBC driver takes in JDBC API (typically DBMS-agnostic) calls from a Java app, and emits DBMS-specific API calls to the DBMS. An ODBC driver takes in ODBC API (typically DBMS-agnostic) calls from a C app, and emits DBMS-specific API calls to the DBMS (often, but not always, to the DBMS "native" network client libraries).
JDBC驱动程序从Java应用程序接收JDBC API(通常是DBMS不可知)调用,并向DBMS发出特定于DBMS的API调用。 ODBC驱动程序从C应用程序接受ODBC API(通常是DBMS不可知)调用,并向DBMS发出DBMS特定的API调用(通常但不总是向DBMS“本机”网络客户端库)。
There are cases where the ODBC and JDBC standards provide special syntax for SQL which varies wildly across DBMS. The app emits a standard-compliant special bit of SQL syntax, which the DBMS-specific driver translates from that DBMS-agnostic SQL dialect into the DBMS-specific dialect of the target DBMS. (example ODBC section, example JDBC section)
在某些情况下,ODBC和JDBC标准为SQL提供了特殊的语法,这些语法在DBMS之间变化很大。该应用程序发出符合标准的特殊SQL语法,DBMS特定的驱动程序将该DBMS不可知的SQL方言转换为目标DBMS的DBMS特定方言。 (示例ODBC部分,示例JDBC部分)
#2
1
A DBMS-specific call means that the driver translates your calls of the JDBC API to calls to the API on the database server (likely different, maybe even very different). For example, calling Connection.createStatement()
might translate to a call to the server with a command allocateStatement
特定于DBMS的调用意味着驱动程序将您对JDBC API的调用转换为对数据库服务器上的API的调用(可能不同,甚至可能非常不同)。例如,调用Connection.createStatement()可能会转换为使用命令allocateStatement对服务器的调用
Equivalent commands here means, that a driver could parse your SQL and translate this to a totally different query language, or maybe even to low-level commands that the database understands. As an example, consider JDBC or ODBC drivers that allow you to query an excelsheet. Excel itself does not understand SQL.
这里的等效命令意味着,驱动程序可以解析您的SQL并将其转换为完全不同的查询语言,甚至可以转换为数据库理解的低级命令。例如,考虑允许您查询excelsheet的JDBC或ODBC驱动程序。 Excel本身不了解SQL。
Another example, one of the predecessors of Firebird had its own query language (this is before SQL was standardized), that was always compiled down to low-level commands. When they initially added support for (dynamic) SQL, this was purely implemented in the client driver. This client driver would parse and compile SQL statements to the same low-level commands, which would then be sent to the server. The server did not understand SQL, and instead it received 'equivalent commands' that it did understand.
另一个例子,Firebird的前身之一有自己的查询语言(这是在SQL标准化之前),它总是被编译成低级命令。当他们最初添加对(动态)SQL的支持时,这纯粹是在客户端驱动程序中实现的。此客户端驱动程序将SQL语句解析并编译为相同的低级命令,然后将这些命令发送到服务器。服务器不理解SQL,而是接收到它理解的“等效命令”。