计算机毕业设计论文毕业设计外文翻译资料.doc_第1页
计算机毕业设计论文毕业设计外文翻译资料.doc_第2页
计算机毕业设计论文毕业设计外文翻译资料.doc_第3页
计算机毕业设计论文毕业设计外文翻译资料.doc_第4页
计算机毕业设计论文毕业设计外文翻译资料.doc_第5页
已阅读5页,还剩3页未读 继续免费阅读

下载本文档

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

文档简介

山西大学本科毕业论文(设计)外文翻译资料外文出处:exploiting software how to break codeby 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使用了何种数据存储格式和编程接口。 1odbc的结构模型 odbc的结构包括四个主要部分:应用程序接口、驱动器管理器、数据库驱动器和数据源。 应用程序接口:屏蔽不同的odbc数据库驱动器之间函数调用的差别,为用户提供统一的sql编程接口。 驱动器管理器:为应用程序装载数据库驱动器。 数据库驱动器:实现odbc的函数调用,提供对特定数据源的sql请求。如果需要,数据库驱动器将修改应用程序的请求,使得请求符合相关的dbms所支持的文法。 数据源:由用户想要存取的数据以及与它相关的操作系统、dbms和用于访问dbms的网络平台组成。 虽然odbc驱动器管理器的主要目的是加载数据库驱动器,以便odbc函数调用,但是数据库驱动器本身也执行odbc函数调用,并与数据库相互配合。因此当应用系统发出调用与数据源进行连接时,数据库驱动器能管理通信协议。当建立起与数据源的连接时,数据库驱动器便能处理应用系统向dbms发出的请求,对分析或发自数据源的设计进行必要的翻译,并将结果返回给应用系统。 2jdbc的诞生 自从java语言于1995年5月正式公布以来,java风靡全球。出现大量的用java语言编写的程序,其中也包括数据库应用程序。由于没有一个java语言的api,编程人员不得不在java程序中加入c语言的odbc函数调用。这就使很多java的优秀特性无法充分发挥,比如平台无关性、面向对象特性等。随着越来越多的编程人员对java语言的日益喜爱,越来越多的公司在java程序开发上投入的精力日益增加,对java语言接口的访问数据库的api的要求越来越强烈。也由于odbc的有其不足之处,比如它并不容易使用,没有面向对象的特性等等,sun公司决定开发一java语言为接口的数据库应用程序开发接口。在jdk1x版本中,jdbc只是一个可选部件,到了jdk11公布时,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页,页中带有能访问远端数据库的applet。或者企业可以通过jdbc让全部的职工(他们可以使用不同的操作系统,如windwos,machintosh和unix)在intranet上连接到几个全球数据库上,而这几个全球数据库可以是不相同的。随着越来越多的程序开发人员使用java语言,对java访问数据库易操作性的需求越来越强烈。 mis管理人员喜欢java和jdbc,因为这样可以更容易经济地公布信息。各种已经安装在数据库中的事务处理都将继续正常运行,甚至这些事务处理是存储在不同的数据库管理系统中;而对新的数据库应用来说,开发时间将缩短,安装和版本升级将大大简化。程序员可以编写或改写一个程序,然后将它放在服务器上,而每个用户都可以访问服务器得到最新的版本。对于信息服务行业,java和jdbc提供了一种很好的向外界用户更新信息的方法。 1jdbc的任务 简单地说,jdbc能完成下列三件事: 1)同一个数据库建立连接; 2)向数据库发送sql语句; 3)处理数据库返回的结果。 2jdbc一种底层的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的预处理器将把这种javasql混用的程序翻译成带有jdbcapi的java程序。 2)实现从关系数据库到java类的直接映射。javasoft和其他公司已经宣布要实现这一技术。在这种“对象关系”映射中,表的每一行都将变成这类的一个实例,每一列的值对应实例的一个属性。程序员可以直接操作java的对象;而存取所需要的sql调用将在内部直接产生。还可以实现更加复杂的映射,比如多张表的行在一个java的类中实现。 随着大家对jdbc兴趣的不断浓厚,越来越多的开发人员已经开始利用jdbc为基础的工具进行开发。这使开发工作变得容易。同时,程序员也正在开发对最终用户来说访问数据库更加容易的应用程序。 3jdbc和odbc及其他api的比较 到目前为止,微软的odbc可能是用得最广泛的访问关系数据库的api。它提供了连接几乎任何一种平台、任何一种数据库的能力。那么,为什么不直接从java中直接使用odbc呢? 回答是可以从java中使用odbc,但最好在jdbc的协助下,用jdbcodbc桥接器实现。那么,为什么需要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的基本设计特征。实际上,这两种接口都是基于xopensql的调用级接口(cli)。它们的最大的不同是jdbc是基于java的风格和优点,并强化了java的风格和优点。 最近,微软又推出了除了odbc以外的新的api,如rdo,ado和oledb。这些api事实上在很多方面上同jdbc一样朝着相同的方向努力,也就是努力成为一个面向对象的,基于odbc的类接口。然而,这些接口目前并不能代替odbc,尤其在odbc驱动器已经在市场完全形成的时候,更重要的是它们只是odbc的“漂亮的包装”。 4jdbc两层模型和三层模型 jdbc支持两层模型,也支持三层模型访问数据库。 如图所示,两层模型中,一个java appple或者一个java应用直接同数据库连接。这就需要能直接被访问的数据库进行连接的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 beup-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 indevelopment 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 three-tier model jdbc support for a two

温馨提示

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

评论

0/150

提交评论