JDBC接口技术外文翻译@中英文翻译@外文文献翻译_第1页
JDBC接口技术外文翻译@中英文翻译@外文文献翻译_第2页
JDBC接口技术外文翻译@中英文翻译@外文文献翻译_第3页
JDBC接口技术外文翻译@中英文翻译@外文文献翻译_第4页
JDBC接口技术外文翻译@中英文翻译@外文文献翻译_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

山西大学本科毕业论文(设计)外文翻译资料 外文出处 : Exploiting Software How to Break Code By Greg Hoglund, Gary McGraw Publisher : Addison Wesley Pub Date : February 17, 2004 ISBN : 0-201-78695-8 译文标题: JDBC 接口技术 译文: JDBC 是一种可用于执行 SQL 语句的 JavaAPI( ApplicationProgrammingInterface 应用程序设计接口)。它由一些 Java 语言编写的类和界面组成。 JDBC 为数据库应用开发人员、数据库前台工具开发人员提供了一种标准的应用程序设计接口,使开发人员可以用纯 Java 语言编写完整的数据库应用程序。 一、 ODBC 到 JDBC 的发展历程 说到 JDBC,很容易让人联想到另一个十分熟悉的字眼“ ODBC”。它们之间有没有联系呢?如果有,那么它们之间又是怎样的关系呢? ODBC 是 OpenDatabaseConnectivity 的英文简写。它是一种用来在相关或不相关的数据库管理系统( DBMS)中存取数据的,用 C 语言实现的,标准应用程序数据接口。通 过ODBCAPI,应用程序可以存取保存在多种不同数据库管理系统( DBMS)中的数据,而不论每个 DBMS 使用了何种数据存储格式和编程接口。 1 ODBC 的结构模型 ODBC 的结构包括四个主要部分:应用程序接口、驱动器管理器、数据库驱动器和数据源。 应用程序接口:屏蔽不同的 ODBC 数据库驱动器之间函数调用的差别,为用户提供统一的SQL 编程接口。 驱动器管理器:为应用程序装载数据库驱动器。 数据库驱动器:实现 ODBC 的函数调用,提供对特定数据源的 SQL 请求。如果需要,数据库驱动器将修改应用程序的请求,使 得请求符合相关的 DBMS 所支持的文法。 数据源:由用户想要存取的数据以及与它相关的操作系统、 DBMS 和用于访问 DBMS 的网络平台组成。 虽然 ODBC 驱动器管理器的主要目的是加载数据库驱动器,以便 ODBC 函数调用,但是数据库驱动器本身也执行 ODBC 函数调用,并与数据库相互配合。因此当应用系统发出调用与数据源进行连接时,数据库驱动器能管理通信协议。当建立起与数据源的连接时,数据库驱动器便能处理应用系统向 DBMS 发出的请求,对分析或发自数据源的设计进行必要的翻译,并将结果返回给应用系统。 2 JDBC 的诞生 自从 Java 语言于 1995 年 5 月正式公布以来, Java 风靡全球。出现大量的用 java 语言编写的程序,其中也包括数据库应用程序。由于没有一个 Java 语言的 API,编程人员不得不在 Java 程序中加入 C 语言的 ODBC 函数调用。这就使很多 Java 的优秀特性无法充分发挥,比如平台无关性、面向对象特性等。随着越来越多的编程人员对 Java 语言的日益喜爱,越来越多的公司在 Java 程序开发上投入的精力日益增加,对 java 语言接口的访问数据库的 API的要求越来越强烈。也由于 ODBC 的有其不足之处,比如它并不容易使用,没有面 向对象的特性等等, SUN 公司决定开发一 Java 语言为接口的数据库应用程序开发接口。在 JDK1 x版本中, JDBC 只是一个可选部件,到了 JDK1 1 公布时, SQL 类包(也就是 JDBCAPI)山西大学本科毕业论文(设计)外文翻译资料 就成为 Java 语言的标准部件。 二、 JDBC 技术概述 JDBC 是一种可用于执行 SQL 语句的 JavaAPI( ApplicationProgrammingInterface,应用程序设计接口)。它由一些 Java 语言写的类、界面组成。 JDBC 给数据库应用开发人员、数据库前台工具开发人员提供了一种标准的应用程序设计接口,使开发 人员可以用纯 Java 语言编写完整的数据库应用程序。 通过使用 JDBC,开发人员可以很方便地将 SQL 语句传送给几乎任何一种数据库。也就是说,开发人员可以不必写一个程序访问 Sybase,写另一个程序访问 Oracle,再写一个程序访问 Microsoft 的 SQLServer。用 JDBC 写的程序能够自动地将 SQL 语句传送给相应的数据库管理系统( DBMS)。不但如此,使用 Java 编写的应用程序可以在任何支持 Java 的平台上运行,不必在不同的平台上编写不同的应用。 Java 和 JDBC 的结合可以让开发人员在开发数据库应用时 真正实现“ WriteOnce, RunEverywhere!” Java 具有健壮、安全、易用等特性,而且支持自动网上下载,本质上是一种很好的数据库应用的编程语言。它所需要的是 Java 应用如何同各种各样的数据库连接, JDBC 正是实现这种连接的关键。 JDBC 扩展了 Java 的能力,如使用 Java 和 JDBCAPI 就可以公布一个 Web 页,页中带有能访问远端数据库的 Ap plet。或者企业可以通过 JDBC 让全部的职工(他们可以使用不同的操作系统,如 Windwos, Machintosh 和 UNIX)在 Intranet 上连接到几个全球数据库上,而这几个全球数据库可以是不相同的。随着越来越多的程序开发人员使用 Java 语言,对 Java 访问数据库易操作性的需求越来越强烈。 MIS 管理人员喜欢 Java 和 JDBC,因为这样可以更容易经济地公布信息。各种已经安装在数据库中的事务处理都将继续正常运行,甚至这些事务处理是存储在不同的数据库管理系统中;而对新的数据库应用来说,开发时间将缩短,安装和版本升级将大大简化。程序员可以编写或改写一个程序,然后将它放在服务器上,而每个用户都可以访问服务器得到最新的 版本。对于信息服务行业, Java 和 JDBC 提供了一种很好的向外界用户更新信息的方法。 1 JDBC 的任务 简单地说, JDBC 能完成下列三件事: 1)同一个数据库建立连接; 2)向数据库发送 SQL 语句; 3)处理数据库返回的结果。 2 JDBC 一种底层的 API JDBC 是一种底层 API,这意味着它将直接调用 SQL 命令。 JDBC 完全胜任这个任务,而且比其他数据库互联更加容易实现。同时它也是构造高层 API 和数据库开发工具的基础。高层 API 和数据库开发工具应该是用户界面更加友好,使用更加方便,更易于理解的。但所有这样的 API 将最终 被翻译为象 JDBC 这样的底层 API。目前两种基于 JDBC 的高层 API正处在开发阶段。 1) SQL 语言嵌入 Java 的预处理器。虽然 DBMS 已经实现了 SQL 查询,但 JDBC 要求 SQL语句被当作字符串参数传送给 Java 程序。而嵌入式 SQL 预处理器允许程序员将 SQL 语句混用: Java 变量可以在 SQL 语句中使用,来接收或提供数值。然后 SQL 的预处理器将把这种Java SQL 混用的程序翻译成带有 JDBCAPI 的 Java 程序。 2)实现从关系数据库到 Java 类的直接映射。 Javasoft 和其他公司已经宣布要实现这一技 术。在这种“对象关系”映射中,表的每一行都将变成这类的一个实例,每一列的值对应实例的一个属性。程序员可以直接操作 Java 的对象;而存取所需要的 SQL 调用将在内部直接产山西大学本科毕业论文(设计)外文翻译资料 生。还可以实现更加复杂的映射,比如多张表的行在一个 Java 的类中实现。 随着大家对 JDBC 兴趣的不断浓厚,越来越多的开发人员已经开始利用 JDBC 为基础的工具进行开发。这使开发工作变得容易。同时,程序员也正在开发对最终用户来说访问数据库更加容易的应用程序。 3 JDBC 和 ODBC 及其他 API 的比较 到目前为止,微软的 ODBC 可能是用得最广 泛的访问关系数据库的 API。它提供了连接几乎任何一种平台、任何一种数据库的能力。那么,为什么不直接从 Java中直接使用 ODBC呢? 回答是可以从 Java 中使用 ODBC,但最好在 JDBC 的协助下,用 JDBC ODBC 桥接器实现。那么,为什么需要 JDBC 呢?要回答这个问题,有这么几个方面: 1) ODBC 并不适合在 Java 中直接使用。 ODBC 是一个 C 语言实现的 API,从 Java 程序调用本地的 C 程序会带来一系列类似安全性、完整性、健壮性的缺点。 2)其次,完全精确地实现从 C 代码 ODBC 到 JavaAPI 写的 ODBC 的翻译也并不令人满意。比如, Java 没有指针,而 ODBC 中大量地使用了指针,包括极易出错的空指针“ void”。因此,对 Java 程序员来说,把 JDBC 设想成将 ODBC 转换成面向对象的 API 是很自然的。 3) ODBC 并不容易学习,它将简单特性和复杂特性混杂在一起,甚至对非常简单的查询都有复杂的选项。而 JDBC 刚好相反,它保持了简单事物的简单性,但又允许复杂的特性。 4) JDBC 这样的 JavaAPI 对于纯 Java 方案来说是必须的。当使用 ODBC 时,人们必须在每一台客户机上安装 ODBC 驱动器和驱动管理器。如 果 JDBC 驱动器是完全用 Java 语言实现的话,那么 JDBC 的代码就可以自动的下载和安装,并保证其安全性,而且,这将适应任何Java 平台,从网络计算机 NC 到大型主机 Mainframe。 总而言之, JDBCAPI 是能体现 SQL 最基本抽象概念的、最直接的 Java 接口。它建构在 ODBC 的基础上,因此,熟悉 ODBC 的程序员将发现学习 JDBC 非常容易。 JDBC 保持了 ODBC 的基本设计特征。实际上,这两种接口都是基于 X OPENSQL 的调用级接口( CLI)。它们的最大的不同是 JDBC 是基于 Java 的风格和优点,并强化了 Java 的风格和优点。 最近,微软又推出了除了 ODBC 以外的新的 API,如 RDO, ADO 和 OLEDB。这些API 事实上在很多方面上同 JDBC 一样朝着相同的方向努力,也就是努力成为一个面向对象的,基于 ODBC 的类接口。然而,这些接口目前并不能代替 ODBC,尤其在 ODBC 驱动器已经在市场完全形成的时候,更重要的是它们只是 ODBC 的“漂亮的包装”。 4 JDBC 两层模型和三层模型 JDBC 支持两层模型,也支持三层模型访问数据库。 如图所示,两层模型中,一个 java Appple 或者一个 JA va 应用直接同数 据库连接。这就需要能直接被访问的数据库进行连接的 JDBC 驱动器。用户的 SQL 语句被传送给数据库,而这些语句执行的结果将被传回给用户。数据库可以在同一机器上,也可以另一机器上通过网络进行连接。这被称为“ Client/Server”结构,用户的计算机作为 Client,运行数据库的计 算机作为 Server。这个网络可是 intranet,比如连接全体雇员的企业内部网,当然也可以是internet。 如图所示,在三层模型中,命令将被发送到服务的“中间层”,而“中间层”将 SQL语句发送到数据库。数据库处理 SQL 语句并 将结果返回“中间层”,然后“中间层”将它们 返回用户。 MIS 管理员将发现三层模型很有吸引力,因为“中间层”可以进行对访问的控制并协同数据库的更新,另一个优势就是如果有一个“中间层”用户就可以使用一个易用的高层的 API,这个 API 可以由“中间层”进行转换,转换成底层的调用。而且,在许多情况下,三层模型可以提供更好的性能。 到目前为止,“中间层”通常还是用 C 或 C+实现,以保证其高性能。但随着优化编译器的引入,将 java 的字节码转换成高效的机器码,用 java 来实现“中间层”将越来越实山西大学本科毕业论文(设计)外文翻译资料 际。而 JDBC 是允许从一个 java“中间层”访问数据库的关键。 指导教师评语: 签字: 年 月 日 JDBC Interface Technology JDBC is a SQL statement can be used for the implementation of the JavaAPI (ApplicationProgrammingInterface Application Programming Interface). It consists of a number of Java Language class and interface components. JDBC for database application developers, database developers Front Desk Tools provides a standard application programming interface, So that developers can use pure Java language to prepare a complete database application. One, ODBC to JDBC course of development Speaking of JDBC, it is tempting to think of another very familiar with the word ODBC. There is no contact between them then? If there is, then between them is What kind of relationship? ODBC is the English abbreviation OpenDatabaseConnectivity. It is a used in related or not related to database management system (DBMS) to access data And implementation using C language, the standard application data interface.通过ODBCAPI, applications can access the stored in a variety of database management system (DBMS) Data, regardless of what the use of each DBMS data storage format and programming interface. 1. ODBC structural model ODBC structure includes four main parts: application program interface, the drive manager, database driver and data source. Application Programming Interface: Shielded different ODBC database drivers the difference between the function call to provide users with a unified SQL programming interface. Driver Manager: In order to load the database application drives. Database drive: implementation of the ODBC function calls to provide data source specific SQL request. If necessary, the database driver will be requested to amend application Order to make the request in accordance with the relevant DBMS supported by the grammar. Data Source: by the user wants to access the data, as well as with its associated operating system, DBMS and the DBMS used to access the network platform. Although the ODBC Driver Manager the main purpose of the database are 山西大学本科毕业论文(设计)外文翻译资料 loaded drive in order to ODBC function call, but the database itself drive the implementation of ODBC Functions Call, and with the database each other. Thus, when the calling application systems and data sources to connect, the database driver can manage communications protocol. When set up with Data source connectivity, database-driven application system is able to handle the request sent to the DBMS of analysis or data source from the bottom of the design of the necessary translation, and The results back to the applications. 2. JDBC birth Since the Java language in May 1995 has been officially announced, Java swept the world. Emergence of many languages with java program, including the database should be Procedure. Because of absence of a Java language API, the programmer has to program in Java language ODBC add C function call. This makes Java a lot of outstanding Unable to give full play to the characteristics, such as platform independence, object-oriented characteristics. As more and more programmers to the Java language increasingly popular, more and more public Secretary for Program Development in Java on the increasing energy input on the java language interface to access the database of the API requirements become stronger and stronger. Also because of the ODBC has its shortcomings The Department, such as it is not easy to use, there is no object-oriented.features and so on, SUN One company decided to develop Java language database interface application development interface. At JDK1. x version, JDBC is an optional component to theJDK1.1announcement, SQL-type package (that is, JDBCAPI) has become the standard Java language, the Department of Pieces. Second, JDBC Technical Overview JDBC is a SQL statement can be used for the implementation of the JavaAPI (ApplicationProgrammingInterface, Application Programming Interface). It consists of a number of Writing Java language class, interface components. JDBC for database application developers, database developers Front Desk Tools provides a standard Application Programming Access The mouth, so that developers can use pure Java language to prepare a complete database application. Through the use of JDBC, developers can easily send SQL statements to virtually any kind of database. In other words, developers do not have to write a Program Access Sybase, write another program to visit Oracle, write a program to visit Microsofts SQLServer. Writing with JDBC procedures can automatically SQL Statement sent to the appropriate database management system (DBMS). Not only that, the use of Java applications can be prepared at any support running on Java platform, not Must in the preparation of different platforms on different applications. The combination of Java and JDBC allows developers to develop database applications really achieve WriteOnce, RunEverywhere! Java has a robust, secure, easy-to-use and other characteristics, but also support the automatic downloading, in essence, is a good database application programming language. It needs Java application is how to work with various database connection, JDBC is the key to achieve this connection. JDBC expanded the ability of Java, such as the use of Java and JDBCAPI can 山西大学本科毕业论文(设计)外文翻译资料 publish a Web page, page with access to remote databases Ap plet. Either Enterprises through JDBC to allow all the workers (who can use different operating systems, such as Windwos, Machintosh and UNIX) at In tranet up to connect to the On a number of global databases, which can be several global databases are not identical. As more and more developers use Java language, Java access to data Treasury ease the demand for more and more strongly. MIS managers like Java and JDBC, as it can more easily publish information economically. Variety has been installed in the database of affairs will continue to deal with Normal operation, and even deal with these matters are stored in different database management systems; and the new database application, the development time will be shortened, installation and version This upgrade will be greatly simplified. Programmers can write or rewrite a program, and then put it on the server, each user can access the server to be up-to-date Version. For the information service industry, Java and JDBC provides a good user to update information to the outside world approach. 1. JDBC-mission Easy to say, JDBC can complete the following three things: 1) set up with a database connection; 2) Send SQL statements to the database; 3) deal with the results of the database back. 2. JDBC-an underlying API JDBC is an underlying API, which means that it will direct calls to SQL commands. JDBC fully qualified for this mission, but also than other database connectivity is more easily Now. It is also constructed at the same time high-level API and database development tools. High-level API and database development tools should be more friendly user interface, the use of more side Then, more easily understandable. However, all this API will eventually be translated into JDBC such as the bottom of API. At present, two high-level API based on JDBC is in development stage Paragraph. 1) SQL language embedded Java pre-processor. While the DBMS has achieved the SQL query, but the JDBC requirements of SQL statements as a string parameter transmitted to the Java way Sequence. The embedded SQL preprocessor allows a programmer to mix SQL statements: Java variables can be used in SQL statements to receive or provide the value. And the pre-SQL This processor will be Java / SQL mix procedures translated into the Java program with JDBCAPI. 2) implementation from the relational database to the Java type of direct mapping. Javasoft and other companies have announced plans to achieve this technology. At this object / relational Mapping table of each line will become an example of this type, each column corresponds to the value of a property instance. Java programmers can directly operate the object; and depositors Check required by the SQL call to be a direct consequence of in-house. Can also achieve more complex mapping, such as tables of many firms of a Java implementation of the class. With the U.S. on the continuing strong interest in JDBC, a growing number of developers 山西大学本科毕业论文(设计)外文翻译资料 have begun to use JDBC-based tools for development. This development work has become Easy. At the same time, programmers are also being developed for end-users easier access to the database applications. 3. JDBC and ODBC, and other API Comparison So far, Microsofts ODBC may be the most widely used relational database access API. It provides a connection to almost any platform, any one of a few According to the ability of the Treasury. Well, why not directly from Java directly using ODBC it? The answer is available from Java using ODBC, but preferably by the help of JDBC, using JDBC-ODBC bridge implementation. So why does JDBC necessary? To return Answer this question, there are so few aspects: 1) ODBC is not suitable for direct use in Java. ODBC is a C language implementation of the API, from Java program to call the local C procedure will bring about a series of similar security Wide, integrity, robustness shortcomings. 2) Secondly, completely accurate implementation ODBC from C code to the ODBC Writing JavaAPI translation is also not satisfactory. For instance, Java no pointer, and ODBC Medium Substantial use of indicators, including the highly error null pointer void *. Thus, Java programmers, the idea put JDBC to ODBC converted into object-oriented The API is very natural. 3) ODBC is not easy to study, it features easy and complex characteristics of mixed together, even for very simple query options are complex. The JDBC just Instead, it has maintained a simple and easy things, but the characteristics of the complex permit. 4) JDBC such JavaAPI for pure Java programs are necessary. When using ODBC, people must be on each client machine to install ODBC drivers and Driver Manager. If the JDBC driver to use Java language are fully realize, then the JDBC code can be automatically downloaded and installed, and to ensure their safety, Moreover, this will adapt to any Java platform, from the NC network computer to the mainframe Mainframe. All in all, JDBCAPI are able to embody the most basic abstraction of SQL, the most direct Java interface. It is the foundation to build on in the ODBC, therefore, familiar with the ODBC JDBC programmers will find very easy to study. JDBC has maintained the basic design features of ODBC. In fact, these two interfaces are based on X / OPENSQL the call-level access I (CLI). Their biggest difference is that JDBC is based on the style and the advantages of Java and Java has strengthened the style and advantages. Recently, Microsoft also launched ODBC except outside the new API, such as RDO, ADO and OLEDB. These API in fact in many ways, like moving on with the JDBC-phase The same direction, which is striving to become an object-oriented, based on the type of ODBC interface. However, these interfaces is currently no substitute for ODBC, particularly in the ODBC Drive has been in the market, when fully formed, more importantly, they are only ODBCs beautiful packaging. 4. JDBC two-tier model and the thr

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论