计算机科学文章—开放数据库互连和Java数据库互连
www.ukthesis.org
06-18, 2015
开放数据库连接和Java数据库连接基本上是客户机或应用程序的连接件,在计算机上的服务器或数据库上运行。连接件的功能是以结构化查询语言(SQL)发送和接收请求命令。一般来说,ODBC是操作系统的一部分代表接口或称为应用程序编程接口(API),它在电脑屏幕上会显示目的是与数据库管理服务器进行对接,因而也被称为服务器。加载一个特定的驱动器后,应用程序在多台电脑运行可与单个数据库通信。以下内容会进一步解释有关的细节。
在这个科技时代,有很多的数据库访问中间件,成为客户端和数据库服务器上应用程序之间的连接体。有许多类型的连接,例如ODBC、JDBC和连接字符串。
Open Database Connectivity and Java Database Connectivity are basically a connection from client or application running on the computer to the server or database. The function of connection is to send and receive request command that written in Structured Query Language (SQL). Generally, ODBC is a part of operating system representing the interface or called Application Programming Interface (API) which display on the computer screen for communication purpose with the Database Management Server (DBMS) also called a server. Applications that running on several computers can communicate with a single database after loading a particular driver. Further detail will be explained.
In this technology era, there are numbers of database access middleware which become a connection between applications on client side and database server. There are many types of connection; ODBC, JDBC and connection string. The connection is used for sending request data from API to the database server and also receiving data which have been requested by the client and translate to the language that can be understand using SQL command. The idea of embedding SQL code into software to allow it to communicate with databases was introduced in 1980s. Databases did not provide internal storage for SQL queries that could be invoked by external programs. Embedded SQL was introduced as database specific extension to high-level languages like C/C++ in order to allow programs to query and manipulate the content of databases. Although this method has been used for some time, it creates many problems with type checking that leads to inefficient and slow evolution of database schemas and software that uses the databases.
开放数据库连接(ODBG)—Open Database Connectivity (ODBC)
During 1992, with the idea to enrich the Call Level Interface (CLI), Microsoft has formed a method of communication to client/server database known as ODBC. As part of Microsoft's Windows Open Systems Architecture (WOSA), ODBC supplies a series of Application Program Interface (APIs) to simplify and also give standards for various programming actions. In addition, a general set of database-access services can be given by the Windows platform with the ODBC model. Once an entity crates an OBDC driver, it can be any type of data sources such as SQL and Oracle server. Therefore, for both Windows and Macintosh data access application, ODBC should rapidly emerge as an important industry standard.#p#分页标题#e#
实际操作—Implementations
Furthermore, ODBC implementations run on many operating systems, including Microsoft Windows, Unix, Linux, OS/2, OS/400, IBM i5/OS, and Mac OS X. Hundreds of ODBC drivers exist, including drivers for enterprise DBMS such as Oracle, DB2, Microsoft SQL Server, Sybase, Pervasive SQL, IBM Lotus Domino, MySQL, PostgreSQL, OpenLink Virtuoso, and desktop database products such as Microsoft Access.
The existence of ODBC alleviates every database and application developers in learning the usage of data access interface. With ODBC, application developers can allow an application to concurrently access, observation, and adjust data from multiple, diverse databases.
ODBC is a specification which application and database developers inscribe as either "ODBC Client" or "ODBC Driver". For the client side or "front-end" there is a data access interface that appears on desktop screen, the example figure of interface will be shown. The driver is loaded on the "server" Database Management System (DBMS) and the "client", however, there is a difference in term of interface and processing method for the front-end computer. A number of users can access data that have been stored on a computer which applied DBMS. The end user should be satisfied of the performance which is faster because the driver is not installed on the computer and no space is required. Furthermore, the end user's computer will secure from any virus attack which can be prevented by reducing unnecessary installation.
优点—Advantages
According to (Harvey, P. 1999), portable data access code and dynamic data binding are the two main advantages of coding an application with the ODBC API.
便携式数据访问代码—Portable Data Access Code
The ODBC API; also known as CLI (command-interface), is available on all major platforms. It is also functioning as outlined by X/Open and the ISO. Microsoft platforms involve numerous enhancements to this specification. Microsoft 3.51 is the recent version. The thought is that by using the ODBC API of a programmer is liable to obtain data access code which is convenient to other platforms. This idea can be visualize from linking to a different ODBC driver to moved over to a heavy SQL server so that data for an accounting program application can be inhabit on a light SQL server during development. In return, platform and data source portability were carried by ODBC
动态绑定—Dynamic Binding
User or the system administrator is enabling by the dynamic binding to simply configure an application to access any ODBC-Â compliant data source. Therefore, it becomes the only biggest advantage of coding an application with the ODBC API and obtaining such an application. The end user can choose a data source, e.g., an SQL server, which enable by the dynamic binding to apply it to all data applications. Thus, no recompiled or recorded of the applications should be done for the new target data source. This can be accomplished when the IDBC calls passes by the ODBC Driver Manager to the user's ODBC driver without require to re-link the code. Consequently, ODBC allow the users to decide a place to store the data.#p#分页标题#e#
开放数据库连接使用的实例—Examples of ODBC in Use
By using the Oracle ODBC Driver and ships with Access 1.1 to access front-end accessing data from on Oracle back-end.
Visual Basic front-end accessing data from a dBase back-end using one part of the MS ODBC Database Drivers Pack, the dBase ODBC Driver.
To access data from an AS/400 using the AS/400 ODBC Driver available from Rochester Software for C application written using C+ODBC SDK+Win SDK.
Many users can share a database is actually a methodology of sharing files. Users should make sure all the applicants that use database are accessible to the database files so they are allow for sharing a database. Besides, the applicants were not a bit can open the database in "exclusive "mode. Other applicant will be prevented from using the database if exclusive mode is use by the user to open a database.
Users have to install the appropriate ODBC driver for the database in their system so that they can access an ODBC database. This driver should be installed by using the ODBC Manager application which located at Windows Control Panel.
ODBC use a Data Source Name (DSN) to permit user to link a database with a driver. On the other hand, ODBC Administration which is located at the Control Panel is used to configure the DSN a unique name then link it to both database and a driver.
User will specify which DSN to be work with once a connection open to ODBC. Therefore, all the tiny details involved in opening database will be taken care by ODBC.
User should configure the ODBC DSNs, the ODBC drivers, and the configuration values used in ODBC.INI before accessing the ODBC database. Besides that, users have to recognize first the structure of an ODBC driver and the ODBC API with some of the ODBC-related terminology.
The application should request a connection from the ODBC Driver Administrator in order to specify the desired data sourced. This has to be done so that any application can obtain data in a database and establish a connection to that database via corresponding ODBC driver.
Firstly, search on ODBC and go for the topic "Using Data Source" .This step should be done by using Help because the Control Panel of Windows 2000 does not include the pointer to the "ODBC Data Source" Secondly, choose the Add button to include a new data source. And finally to complete this process, select the appropriate driver to use for the database then click the Finish button.
Java 数据库连接—Java Database Connectivity (JDBC)
JDBC known as a programming framework for Java developers writing programs which access information kept from database, spreadsheets, and flat files. User normally used JDBC to connect a program to a "behind the scenes" database. However, the connection depends of what database management software is used to control the database. A connection of transferring data form client to database and vice versa is one of the similar role of ODBC and JDBC. In addition, to connect the database both data access middleware were regardless on X/Open standard. Conversely, the language used of applications running on the client side distinct both ODBC and JDBC. JDBC can be only use on the applications that written in Java language or code. (Henry, K. 2001).#p#分页标题#e#
Basically, ODBC and JDBC have similar idea of function which becomes a connection or medium of transferring data form client to database and vice versa. The X/Open standard for database connectivity influence when these two data access middleware. The difference of both ODBC and JDBC is the language utilization of applications running on the client side. JDBC is only focused on the applications that written in Java code or language.
实际操作—Implementations
According to (Konchady, 1998), two kind of architectures can be use when communicate the database. Firstly, the directly communication between JDBC driver and database. Once the driver has connected to database, the SQL statements are the commands on representative of the Java program. The driver manager will receive back the outcome from the response of the database and finally to the required commands of the application.
Secondly, communication between the ODBC driver and JDBC driver through a "bridge". A particular JDBC driver can correspond with numerous ODBC drivers. ODBC drivers perform SQL commands for exact databases to avoid complication of data retrieval.
数据库通信体系结构—Database Communication Architecture
On top of that, the creating of JDBC/ODBC Bridge is to gain benefit of the large amount of ODBC-enabled data sources. The bridge execution to converts JDBC calls to ODBC call and it become as the backend database by passing the converted calls to the appropriate driver. In return, this scheme is advantage because data can be access from multiple vendors. Nevertheless, due to the added overhead the performance of a JDBC/ODCB bridge is slower if compare to a JDBC driver alone. Therefore, JDBC must be translated to ODBC to a native API to create a database call.
从小型应用程序访问数据库—Accessing a Database from an Applet
By using a JDBC driver without a bridge it will required with lesser operations. Firstly, MySQL database is used with Gwe JDBC driver and from the Gwe host site, JDBC driver classes has to be download. After that, JDBC call will be passes by the applet logis to a driver manager which on the other hands will passes the call to a JDBC driverNext, JDBC driver will enable a TCP/IP connection with the MySql database server. Then, data is relocating back and forth through the connection. Lastly the connection will automatically close when the processing of the database has completed.
The JDBCAPI can be applied to stand-alone applications and applets. However, the connections from the same server where the applet was downloaded only can be accepted due to the common applets restriction. Thus, to route the database traffic the web server should first run a proxy service in the event where the web server and database server are from the different machine. On top of that, local information and remote servers are able to access by stand-alone applications.#p#分页标题#e#
Java applets and programs can function as the drivers' API to link to databases, repository and bring back database component as well as achieve saved methods. Therefore, creation JDBC a Java-enabled transmission machinery for SQL. Driver type 1 is providing JDBC connectivity via ODBC drivers through a JDBC-ODBC bridge. Each client device that utilizes a JDBC-ODBC bridge must be loaded by database-specific client code and ODBC program code. Sun clarified driver type 1 for expediency's purpose up to the time of software vendors had invented the other three types of drivers. The administrators are required to install ODBC drivers on the client devices and configure it.
Driver type 2 includes of an interface, formulated to some extent in Java, among the vendor-specific database access middleware such as Oracle SQL*Net or Sybase Open Client, and Java programs. JDBC driver type 2 is typically a straight link the proprietary API of to the database products; Oracle OCI. It doesn't need the existence of ODBC. It does, however, require the administrators to configure the database vendor's proprietary database access middleware by installing it first.
Driver type 3 is functioning as a calls translator into a database-independent network protocol from JDBC at the client side. Moreover, there is a separate driver part at the server which translates the database-independent JDBC demands into database-specific, local calls. Type 3 drivers are in this way able to link Java-based clients to a separate server-side driver that has been developed from other types of databases. Type 3 drivers desire fundamental network protocol, TCP/IP for instance at the client side, however they do not rely on the existence of ODBC or vendor-specific middleware. Nevertheless type 3 drivers have to be complex enough to deal with a multiplicity of networking conditions, involving firewalls. Furthermore, Java program utilizing a type 3 driver can pretension to be most general, on running any Java-enabled platform from a connected database server with a TCP/IP. Among its other benefits, a type 3 driver is well-matched for function over the Internet.
Driver type 4 is a simple Java driver which becomes a request converter into a database vendor's particular network protocol from JDBC. Vendor's database product approaches which consume by a Java approaches also have authorization. Type 4 drivers are better matched for intranet function than Internet function. Since it relies on database access protocols from database vendors' proprietary, a type 4 driver is further distinctly possible to move towards from a database vendor.
The browser will display on the screen once the application is running.
A Data Manipulation window and a Database Metadata window will be open once the establishment of the database to the connection. The Database Metadata window has two frames and its function by instantly browse the database metadata as well as the current database. Thus the attributes of the table names from currently opened database. On the other hand, the attribute names and types will be show in the header by the bottom frame once a table name is selected.#p#分页标题#e#
The examples of SQL statement are SELECT, INSERT, UPDATE or DELETE. The user can enter any of these statements on the text window provided.
JDBC 的性能—JDBC Performance
AÂ simple as well as practical language, Java tenders a number of advantages: portability, fewer likelihoods of programmer inaccuracies, reusability of entities and combination with intranet/Internet technologies. Nevertheless, Java is an interpreted language, sense that you run a computer program such as browser which turn executes the recommendations within a Java program. Considering that Java is interpreted, it sometimes serves performance inconveniences to application originators. JDBC drivers written in simple Java, or partly in Java, sometimes function slower than expected. To figure out the inconvenience, there will productions of Java run-time optimizations, JIT (Just-In-Time) compilers, and even Java-specific CPU chips. Java's performance will get better over duration, and the existing state of matters is frequently more than sufficient for data entry. Even so, JDBC performance can be a concern for drivers written in Java.
优点—Advantages
There are 3 kind of modules which namely JDBC driver, a class file which is known as the Java run-time environment and the driver manager. The ODBC driver will become a different layer if the JDBC-ODBC Bridge was preferred by the users. Longer initialization duration occupied from the extra layers of code as it suggest additional processing. Thus, users are recommended to develop the Web server computer as well a database server. Furthermore, this approach allow users to connect an appliance straight to the database through a JDBC driver which written in pure Java. On the other hand, users can find a flexibility in platform choices by using a separate database server computer when configure the Web server with a proxy.
缺点—Disadvantages
Database and driver vendors require to perform some enhancements in JDBC before it turns out to be really functional. The first enhancement is to alleviate users in retrieving data according to sequence of rows in a table. The existing cursor is not effectively functioning because it cannot move backward. Hence, the user cannot capture the previous data; however, they can capture the current data that being saved.
JDBCÂ drivers also require being able to deal with the breaking block of records separately and for this matter, it involves multiple rows returned in a single reply message. Usually, there are a number of rows for a query to get a result and by sending every row at one time and not concurrently is time consuming. An application will receive a single reply which consists multiple of rows from database and once the reply has been deblocked, the next row will be deliver by JDBC driver.
#p#分页标题#e#
总结—Conclusion
This article has covered ODBC and JDBC specifically, in term of the definitions that have been cited from a number of journal articles, the history which explained when and why this connectivity being invented. In addition, the steps in utilizing ODBC and JDBC for the beginners also shown graphically to alleviate readers for their understanding. There are many technical terms used for reader's exploration of this subject such as name of the Operating System (OS), database, server, software and languages. Moreover, this article contains the broader information regarding to ODBC and JDBC and not only focusing on specific part.
如果您有论文代写需求,可以通过下面的方式联系我们
点击联系客服