版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、大连交通大学2009届本科生毕业设计(论文)外文翻译JDBC (Java Data Base Connectivity)Bruce EckelThinking in Java .4th edition.JDBC (Java Data Base Connectivity) is a SQL statement for the implementation of the Java API, for a variety of relational databases to provide a unified visit by a group, its using Java language prep
2、aration classes and interface. JDBC for tools / database development provides a standard API, which can build more sophisticated tools and interfaces to database developers Pure Java API can be used to prepare database applications, at the same time, JDBC is also a brand name With JDBC, data sent to
3、 the various relationships SQL statement is a very easy matter. In other words with JDBC API, we do not have to visit a Sybase database to write specialized procedures, visit the Oracle database specifically to write a program, or visit Informix database and the preparation of another procedure, pro
4、grammers should use the JDBC API to write a procedure enough, it can be sent to the corresponding SQL database calls Meanwhile, the Java language and JDBC to integrate non-programmers do not have to, with a platform for the preparation of different applications, just write it again in the process ca
5、n be run on any platform, which is the Java language Write once, run everywhere advantage Java database Connect Architecture for Java application of the standard method of connecting to the database JDBC is the case of Java programmers API, and the realization of the database connection is the case
6、of service providers interface model.As API, JDBC program development for the provision of standard interfaces, and database vendors and third-party middleware vendors to achieve connectivity and database provides a standard method JDBC use the existing SQL standard Support and other databases and c
7、onnectivity standards, such as bridge between ODBC. JDBC achieve all these objectives and standards for a simple, highperfbrmance and strict definition of achieving type interface. Java with a solid, safe, easy to use, easy to understand and can be automatically downloaded from the Internet and othe
8、r characteristics of the preparation of the outstanding database application language Need is a Java application Database with a variety of different procedures for a dialogue between the methods. The JDBC is the mechanism for such purposes. Java JDBC expanded functionality. For example, with Java a
9、nd JDBC API Applet can be issued containing the page, and the applet may use the information from remote databases enterprises can also use JDBC to all staff through the Intranet will be connected to one or more Internal database (even if those staff computers are used by Windows, Macintosh, and UNI
10、X, and other various operating systems). As more and more programmers using Java Programming language, Java from the convenient access to the database requirements are increasing. MIS administrators like the combination of Java and JDBC, because it makes it easy to disseminate information and Econom
11、y. Enterprises can continue to use their installed database, and can easily access information, even if this information is stored in the different database management systems The development of new procedures is a very short period. An Equipment and version control will be greatly simplified Progra
12、mmers can prepare only what applications or updated only once, and then put it on the server, and then on any person can get the latest version of the application. Sales for the business information services, Java and JDBC for external customers with better access to information update method.First,
13、 the use of JDBCSimply put, JDBC to do three things: establish a connection with the database, send SQL statements and the results. The following codes are the basic examples:Connection con = DriverManager.getConnection ( Mjdbc: odbc: wombat/* login* nPasswordM);Statement stmt = con.createStatement
14、();ResultSet rs = stmt.executeQuery ( SELECT a, b, c FROM Table 1H);While (rs.next () Int x = rs.getlnt ( HaH);String s = rs.getString ( HbH);Float f = rs.getFloat ( cM);Based on the above code JDBC database access to a summary of the classic, of course, in this part of the follow-up section we will
15、 do a detailed analysisSecond, JDBC APIJDBC is a low-level interface, that is, it calls for direct SQL commands. In this respect it functions very good, and other than the easy-touse database connectivity API, but it also has been designed as a basis interface, it can be established on the High inte
16、rface and tools. High interface is user-friendly interface, which uses a more comprehensible and more convenient API. This API is converted in the behind-the-scenes such as JDBC such a low- level interface In the relational database object / relationship11 mapping, each row in the table correspondin
17、g to the category of an example, the value of each column the examples should be an attribute. Therefore, programmers can directly operate on the Java objects; SQL for data access call will be under the guise of* automatically generated. They can also be more complex mapping, for example, a number o
18、f rows in the table integrated into a Java class. With the interest of the people of JDBC the growing, and more and more developers have been using JDBC-based tools So that the preparation process more easily Programmers has been trying to make in the preparation of end-user database access has beco
19、me more simple applications. For example, applications can provide a choice of According to the mandate of the menu. Task was chosen, the application will be given tips and blank selected for the task of completing the implementation of the necessary information Application procedures for the import
20、ation of the required information will automatically call for SQL Order. In such a process with the assistance, even if they do not understand the fundamental SQL syntax, but also can perform database tasks.Third, JDBC and ODBC compared with other APICurrently, Microsofts ODBC API is the most widely
21、 used for the visit of the relational database programming interface It can connect almost all platforms almost all databases For What Java does not use ODBC? The answer to this question is: Java can use ODBC, but preferably with the help of the JDBC to JDBC-ODBC Bridge in the form of use of this po
22、int, we later say. The problem now has become: ”Why do we need JDBC? The answer is clear: ODBC not suitable for direct use in Java, because it uses C language interface. Transferred from Java C code in the local security, achieved solid and procedural aspects of the automatic transplantation has man
23、y shortcomings. From ODBC C API Java API to the literal translation is not advisable For example, Java does not guide, and it has ODBC indicators used very widely (including very error-prone Guidelines void *”) You can imagine JDBC will be converted into the object-oriented interface to the ODBC, an
24、d the object-oriented interface to make it easier for Java programmers to receive ODBC is difficult to learn. It simple and advanced features of the mix, and even the simple query, the options are extremely complex. On the contrary, JDBC to guarantee simple function of simplicity, At the same time,
25、if necessary, to allow the use of advanced features. The opening of pure Java mechanism needs such as JDBC Java API. If you use ODBC, it is necessary to manually will be ODBC driver management and driver installation in each client machines If completely written in Java JDBC Driver in all the JDBC c
26、ode on the Java platform (from the computer network to the mainframe) can be Automatic installation, and guarantee the safety of transplantationIn short, JDBC API for SQL abstract and basic concepts of Java is a natural interface. It is built on ODBC rather than starting from scratch. Therefore, pro
27、grammers will be familiar with ODBC JDBC found very easy to use. ODBC JDBC retains the basic design features; In fact, the two interfaces are based on the X / Open SQL CLI (call-level interface). Among them the largest district, another is: Java JDBC to style and based on the merits and optimization
28、, more easy to use.At present, Microsoft has introduced a new addition to ODBC API: RDO, ADO and 大连交通大学2009届本科生毕业设计(论文)外文翻译OLE DB. These design in many ways and JDBC is the same, that is, they are the object- oriented Based on the database interface and can be achieved on ODBC in the category. But t
29、he interface, we did not see any special features that make their choice we need to turn to alternative ODBC, especially in the ODBC Flooding Has been established procedure for better market conditions They also is the largest in the ODBC add a decoration only.Forth, JDBC on the B / S and C/S mode s
30、upportJDBC API supports both the two-tier model of database access (C / S), but has also supported the three-tier model (B / S). In the two-tier model, Java applet or application will be directly into the database to dialogue. This will require a JDBC driver to visit with the specific database manag
31、ement systems to communicate. Users of SQL statements sent to the database, and its results will be returned to user. Database can be located on another computer, users connected to the above network. This is called client / server configuration, usefs computer for the client, providing database com
32、puting Machines for servers Intranet network can be (it can be linked to company staff), it can also be an internetIn the three-tier model, the order was first sent to the middle layer1, and then by the SQL statement it sent to the database Database on SQL statement processed and the results sent ba
33、ck to the middle Layer, the middle layer then the results returned to users. MIS managers have discovered the three-tier model is very attractive, because the middle layer can be used to control access to company data and can be used for the newer types. In Another advantage of inter-layer, the user
34、 can use the easy-to-use high-level API, and the middle layer will be converted to its corresponding low-level calls. Finally, in many cases under the three- tier structure can provide some performance on the benefitsSo far, the middle layer are usually in C or C + + language to prepare such, the im
35、plementation of these languages faster. However, with the most optimized compiler (it to switch to Java byte code Efficient in the specific machine code) the introduction, use Java to achieve middle layer will be more practical. This will be a big step forward, it enables people to take full advanta
36、ge of the many Java Advantages (such as robust, multi-threaded, and security features). For Java JDBC from the middle layer to access a database is very important.Fifth, SQL consistencyStructured Query Language (SQL) relational database access is the standard language The tricky part is: Although mo
37、st of the DBMS (database management system) to use the basic functions Standard forms of SQL, but they are not consistent with the recent higher standard definition of the functions of SQL syntax or semantics. For example, not all databases support stored procedures or external connections, it More
38、support this function in the database and mutually inconsistent. It is hoped that the SQL standard that the real part to expanding to include more and more functions But at the same time it must support JDBC API With the existing SQL.JDBC API solution to this problem is to allow a way for any string
39、 has been reached by the driver on the DBMS. This means that applications can use any number of SQL Functional, but it must take the risk: it is possible in some DBMS errors In fact, applications for SQL even if not, or that it may be for a specific DBMS Design SQL dedicated derivatives (for example
40、, documents or images enquiries). JDBC deal with the issue of consistency SQL second method is to provide ODBC-style escape clause, which will in the follow-up Part of the discussion. Escape for a few common grammatical differences SQL provides a standard syntax JDBC For example, the date has been s
41、tored text and the process of calling all escaped grammar. For complex Miscellaneous applications, JDBC third method used to deal with the issue of consistency in its SQL Database Meta Data interface to use DBMS on the description of information, thus enabling application - Each DBMS order to adapt
42、to the requirements and functional. As JDBC API will be used to develop advanced tools and database access API, API basis, it must also pay attention to all of its superstructure consistency. nTM with JDBC standards/* representatives of the JDBC users can rely on the standard-level functions To use
43、this statement, the driver must be at least support the ANSI SQL-2 Entry Level (ANSI SQL-2 represent the United States National Bureau of Standards in 1992, the standards adopted Entry Level SQL functions on behalf of a specific list). Driver developers can be carried by the JDBC API Testing kits to
44、 determine whether the driver of their compliance with these standards. HTM with JDBC standards/* said the JDBC providers have been adopted to achieve the Java Soft the conformance testing. These tests will check the consistency of the definition of JDBC API all the classes and methods exist, as far
45、 as possible, to check whether the procedures SQL Entry Level function. Of course, these tests not entirely, but now has no intention of Java Soft the various providers to the realization of superscript level. However, this definition of consistency can indeed achieve the JDBC provide a certain degr
46、ee of credibility. As more and more Database providers, connecting providers, Internet providers and application programming Members of the JDBC API acceptance, JDBC is also rapidly becoming the standard Java database access.Sixth, JDBC entrance Establishment of connectionYou need to do the first th
47、ing is you want to use the DBMS and the establishment of a connection. This includes two steps: loading drivers and establish a connection.Loading driversLoading drivers need only a very simple line code For example, you want to use JDBC-大连交通大学2009届本科生毕业设计(论文)外文翻译ODBC Bridge Driver, loading it with
48、the following code:Class.forName (,sun.jdbc.odbcJdbcOdbcDriverH);Document your driver will tell you should use the class name For example, if the category were jdbc.DriverXYZ, you will be used to code the following code loading drivers:Class.forName ( Mjdbc.DriverXYZn);You do not need to create an i
49、nstance of the class driver and register it with DriverManager, because calls will be automatically loaded Class.forName Driver category If you had to create their own examples, you will create an unnecessary copy, but it will not do any harm.Loading Driver category, they can be used to connect with
50、 the databaseConnectionThe second step is to use the appropriate driver of the establishment of a connection with the DBMS. The following code is the general practice:Connection con = DriverManager.getConnection (url, MmyLogin, HmyPasswordn);This step is very simple and the most difficult is how to
51、provide url. If you are using JDBC-ODBC Bridge, JDBC URL will be jdbc: odbc beginning: the remaining URL is usually your data source name, or database system. Therefore, assuming that you are using ODBC access to a man named Fred ODBC data source, your JDBC URL is jdbc: odbc: Fred. MyLogin” and myPa
52、ssword” landing DBMS are the replacement for your user name and password If you landing database system are the user name Fernanda Password only the following two lines of code can establish a connection:String url = Mjdbc: odbc: Fred;Connection con = DriverManager.getConnection (url, FernandaJ nJ8n
53、);If you are using the third-party developers of the JDBC driver, the documents will tell you what subprotocol use is in the JDBC URL on the back of some jdbc For example, if a driver developers registered as a subprotocol acme, JDBC URL in the first and second part will be jdbc: acme Drivers will t
54、ell you the remaining documents JDBC URL format. JDBC URL last part of the positioning is to provide the information in the databaseIf you load the driver identification provided to the JDBC URL DriverManager.getConnection, that driver will be the establishment of a JDBC URL link to a specific DBMS
55、As the name indicates, DriverManager class management behind the scenes for you to connect all the details. Unless you are writing drivers, you may not use any other method such, the general programmers need to use such a direct approach is the only DriverManager.getConnection.DriverManager.getConne
56、ction method returns an open connection, you can use this link to create JDBC statements and send SQL statements to the database In the preceding example, the object is a con opened connection, and we will in the future example, use it.文章出 处:/crossroads/columns/ovp/march2001 .html9中
57、文翻译JDBC (数据库连接)JDBC (Java Data Base Connectivity, java数据库连接)是一种用于执彳亍SQL语句 的Java API,可以为多种关系数据库提供统一访问,它由一组用Java语言编写的类和 接口组成。JDBC为工具/数据库开发人员提供了一个标准的API,据此可以构建更高级 的工具和接口,使数据库开发人员能够用纯Java API编写数据库应用程序,同时, JDBC也是个商标名。有了JDBC,向各种关系数据发送SQL语句就是一件很容易的事。换 言之,有了JDBC API,就不必为访问Sybase数据库专门写一个程序,为访问Oracle数 据库又专门写一
58、个程序,或为访问Informix数据库又编写另一个程序等等,程序员只 需用JDBC API写一个程序就够了,它可向相应数据库发送SQL调用。同时,将Java语言 和JDBC结合起来使程序员不必为不同的平台编写不同的应用程序,只须写一遍程序就 可以让它在任何平台上运行,这也是Java语言“编写一次,处处运行”的优势。Java 数据库连接体系结构是用于Java应用程序连接数据库的标准方法。JDBC对Java程序员 而言是API,对实现与数据库连接的服务提供商而言是接口模型。作为API, JDBC为程序开发提供标准的接口,并为数据库厂商及第三方中间件厂商 实现与数据库的连接提供了标准方法。JDBC使
59、用已有的SQL标准并支持与其它数据库连 接标准,如ODBC之间的桥接。JDBC实现了所有这些面向标准的目标并且具有简单、严 格类型定义且高性能实现的接口。Java具有坚固、安全、易于使用、易于理解、可从 网络上自动下载等特性,是编写数据库应用程序的杰出语言。所需要的只是Java应用 程序与各种不同数据库之间进行对话的方法。而 JDBC 正是作为此种用途的机制。 JDBC扩展了 Java的功能。例如,用Java和JDBC API可以发布含有applet的网 页,而该applet使用的信息可能来自远程数据库企业也可以用JDBC通过Intranet 将所有职员连到一个或多个内部数据库中(即使这些职员所用的计算机有 Windows. Macintosh和UNIX等各种不同的操作系统)。随着越来越多
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年江西枫林涉外经贸职业学院单招综合素质笔试备考试题含详细答案解析
- 2026年武汉城市职业学院高职单招职业适应性测试备考题库及答案详细解析
- 2026年内江职业技术学院单招综合素质考试备考试题含详细答案解析
- 2026年广东工程职业技术学院单招综合素质笔试备考试题含详细答案解析
- 2026年罗定职业技术学院高职单招职业适应性测试备考题库及答案详细解析
- 2026年江西陶瓷工艺美术职业技术学院单招综合素质笔试备考试题含详细答案解析
- 2026年甘肃机电职业技术学院单招综合素质考试备考题库含详细答案解析
- 2026年山西经贸职业学院单招职业技能考试参考题库含详细答案解析
- 2026年闽江师范高等专科学校单招职业技能考试备考试题含详细答案解析
- 2026年辽宁轨道交通职业学院单招职业技能考试参考题库含详细答案解析
- 主播合作协议解除协议书
- 临床检验初级师历年试题及答案2025版
- 文第19课《井冈翠竹》教学设计+2024-2025学年统编版语文七年级下册
- 干部教育培训行业跨境出海战略研究报告
- 车库使用协议合同
- 组件设计文档-MBOM构型管理
- 《不在网络中迷失》课件
- 山东省泰安市2024-2025学年高一物理下学期期末考试试题含解析
- 竹子产业发展策略
- 【可行性报告】2023年硫精砂项目可行性研究分析报告
- 2024-2025年上海中考英语真题及答案解析
评论
0/150
提交评论