Home Database Mysql Tutorial Web数据库中间件技术_MySQL

Web数据库中间件技术_MySQL

Jun 01, 2016 pm 02:05 PM
cgi jdbc web technology database server

Web数据库中间件技术
曾晓金



(云南工业大学计算机应用重点实验室 昆明 650051)



摘要:介绍了Web数据库的几种中间件解决方案,并比较了它们的特色与不足,以及Web数据库出现的相应最新技术。

关键词:中间件 CGI ASP ISAPI NSAPI JDBC



随着Internet/Intrranet的兴起与发展,Web服务器与数据库服务器的连接显得越来越重要,许多厂家不断推出新技术、新产品,使得连接更加简洁、迅速和方便。Web与数据库连接技术已成为基于Web的信息管理系统的核心,为Internet上的电子商贸打下了基础。

一般来说,通过Web页实现对数据库访问的基本框图如图1,在整个系统中关键的技术是中间件的解决方案。



图1、Web页面访问数据库示意图



中间件负责管理Web服务器和数据库服务器之间的通信并提供应用程序服务。由于驻留在Web服务器上,因而中间件软件能够调用作为Web服务器和数据库服务器间"传输机制"的外部程序或"编码",并将执行查询等以HTML页面或纯文本的形式将信息返回给最终用户。数据库服务器负责管理驻留在数据库服务器中的数据。



一、现对当前几种流行的中间件的解决方案作一讨论。

1.通用网关技术(CGI)

CGI是一种Web站点上可以用来访问Web站点的用户交互的各种程序的标准,使用CGI脚本允许用户在浏览器中等服务器上的数据库交互,完成对数据库的各种操作。

几乎使用的服务器软件都支持CGI,开发者可以使用任何一种Web服务器内置语言编写CGI,包括Perl语言,C,C ,VB和Delphi等。

CGI的工作原理是浏览器通过Web页面的表单搜索参数,这些参数通过HTTP传递Web服务器,在服务器通过CGI脚本分析参数(命令行参数或环境变量),同时启动通路程序,把分析后的参数转化为SQL命令,交数据库服务器执行,然后CGI程序返回处理结果给Web服务器,最后向客户机返回HTML或纯文本格式的结果并断开连接。

CGI缺点是执行速度较慢,Web服务器每启动一个数据查询服务,就必须启动一个新的CGI进程,相对服务器资源代价比较高。

2.ASP(Active Server Pages)

ASP是一种开放的,可以将HTML脚本及可重用的Active Server组件结合在一起以建立高效的动态的基于Web的应用程序环境,利用ASP,可以增加运行在服务器端的脚本的新特性,如访问数据库。

ASP支持Active Server组件的使用,Active Server组件通过组件对象模型(COM)为ASP提供了可编程的界面,其中组件之一Active Data Object(ADO)提供了与数据库相连的机制。且使用ASP可以直接在HTML文件中包含可执行的脚本,HTML开发和脚本开发可以变为一个过程,而不象CGI、ISAPI以及其他方法一样,程序和HTML文件要求在不同的设计环境导致程序产生和修改困难。

3.应用编程接口(API)

鉴于CGI的一些缺陷,Microsoft和Netscape开发了专用的Web服务器中的程序代码(如动态链接库DLL),且一般与Web服务器软件处在内存的同一地址空间中,因此每次调用时是在内存中运行相应的程序段,而不是像CGI那样需要启动新的进程,因而效率要比CGI高得多。

API技术主要缺点是开发难度大,且可移植性差,开发出的应用程序只能在相应的Web服务器上运行,缺乏通用性。

为了减轻开发应用程序的困难,Netscape和Microsoft在其各自的服务器中提供了基于API的编程接口。Netscape提供了基于NSAPI的Livewire,它是专门设计的全面开发方案,开发人员可以开发和管理WWW界面、WWW网点,并且可以利用SQL语句或ODBC直接访问数据库。Microsoft则提供了基于ISAPI的IDC模块,它是IIS的一个动态连接库(httpodbc.dll),并通过ODBC访问各类数据库。

4.JDBC技术

Java是一种简单、面向对象、易传送、稳固安全、多线程执行控制及3D空间设计的语言,它为Internet注入了交互性。Java支持数据库的访问,是因为SUN公司提供了一种标准的SQL访问数据库的Java语言应用程序编程接口(JDBC)。构成Java语言的基础是一系列类库,而JDBC正是定义了Java与数据库之间的接口类库(Java.sql包),它是Java语言中执行SQL语句的API,它由一系列类和接口所组成,这些类和接口均是由Java语言写成的,通过它一个程序开发者可以在Java语言中建立与数据库的链接,执行SQL语句和处理SQL语句返回的结果。

采用JDBC很容易用SQL语句访问异构数据库,如通过JDBC API,只需编写一个JDBC API,就可以把SQL查询语句送往Sybase,Oracle或 Informix数据库,同时采用Java语言编写应用程序,具有平台无关性,不要为不同的平台编写不同的应用程序。



图2、JDBC技术工作示意图



采用JDBC技术其工作方式为:客户端首先访问Web服务器,下载Java字节码文件,并将Applet相关类的字节码文件和JDBC接口字节码文件下栽到客户端,然后与Web服务器脱离,接着Applet根据数据库地址,端口号和帐号与数据库服务器连接进行交互,这样用户与数据库服务器的交互是由浏览器直接完成的。由于JDBC技术的可操作性、可维护性和安全性及事务处理能力、使用效率都比较高,因此具有很大的优势。

Java与数据库的连接机制与CGI和API有所不同,在客户机上运行Java Applet通过JDBC技术可以绕过Web服务器直接和数据库服务器连接,并直接把带有结果的HTML页返回客户机浏览器。

象ODBC一样,JDBC提供给程序员的编程接口是由两部分组成,一是面向应用程序的编程接口JDBC API,它是为应用程序员提供的,二是供底层开发的驱动程序接口JDBC Driver API,它是各个商业数据库厂商提供的。目前,JDBC已经得到了许多厂商的支持,包括 Borland,IBM,Oracle和Sybase等公司,当前流行的大多数数据库系统都推出了自己的JDBC驱动程序。



二、结束语

数据库在Web上的应用无疑增强Web的功能和吸引力,我们可以采用不同的中间件解决方式把Web与数据库相集成,达到综合信息服务的目的。值得关注的是JDBC技术,JDBC作为新的联结Web服务器与数据库的桥梁,同时仍保留着Java本身许多引人注目的特性,大多数流行的数据库系统都已推出了自己的JDBC驱动程序,其主要的问题则是代码的执行效率问题,同时,还面临着微软公司的ActiveX的有力挑战。





参 考 文 献

1、[美]Jeffry Dwight等著 ,CGI开发使用手册,机械工业出版社

2、[美]Daniel J.Berlin,etal著,清华大学出版社

3、张世永编,数据库与WWW,复旦大学出版社

4、陈品德,基于Web的信息系统的开发,计算机工程(1998、3)

5、邵立兵,Sybase数据库与Web的互连,计算机工程(1998、3)

6、陈喃,Java的远程数据库访问模型及其实现,计算机系统应用(1998、9)

7、刘东等,基于WWW的数据库应用,计算机系统应用(1998,4)

8、罗东川,JAVA语言与DataBase 之间的接口--JDBC,计算机系统应用(1998,3)

9、罗娟等,Web 与数据库技术,计算机工程(1998,8)

10、谭郁松等,基于Web环境下的异构数据库连接技术的研究与实现,计算机工程(1998、8)


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

How does Hibernate implement polymorphic mapping? How does Hibernate implement polymorphic mapping? Apr 17, 2024 pm 12:09 PM

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Review! Deep model fusion (LLM/basic model/federated learning/fine-tuning, etc.) Review! Deep model fusion (LLM/basic model/federated learning/fine-tuning, etc.) Apr 18, 2024 pm 09:43 PM

In September 23, the paper "DeepModelFusion:ASurvey" was published by the National University of Defense Technology, JD.com and Beijing Institute of Technology. Deep model fusion/merging is an emerging technology that combines the parameters or predictions of multiple deep learning models into a single model. It combines the capabilities of different models to compensate for the biases and errors of individual models for better performance. Deep model fusion on large-scale deep learning models (such as LLM and basic models) faces some challenges, including high computational cost, high-dimensional parameter space, interference between different heterogeneous models, etc. This article divides existing deep model fusion methods into four categories: (1) "Pattern connection", which connects solutions in the weight space through a loss-reducing path to obtain a better initial model fusion

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

More than just 3D Gaussian! Latest overview of state-of-the-art 3D reconstruction techniques More than just 3D Gaussian! Latest overview of state-of-the-art 3D reconstruction techniques Jun 02, 2024 pm 06:57 PM

Written above & The author’s personal understanding is that image-based 3D reconstruction is a challenging task that involves inferring the 3D shape of an object or scene from a set of input images. Learning-based methods have attracted attention for their ability to directly estimate 3D shapes. This review paper focuses on state-of-the-art 3D reconstruction techniques, including generating novel, unseen views. An overview of recent developments in Gaussian splash methods is provided, including input types, model structures, output representations, and training strategies. Unresolved challenges and future directions are also discussed. Given the rapid progress in this field and the numerous opportunities to enhance 3D reconstruction methods, a thorough examination of the algorithm seems crucial. Therefore, this study provides a comprehensive overview of recent advances in Gaussian scattering. (Swipe your thumb up

Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Equipped with AMD EPYC 4004 series processors, ASUS launches a variety of server and workstation products Jul 23, 2024 pm 09:34 PM

According to news from this website on July 23, ASUS has launched a variety of server and workstation-level products powered by AMD EPYC 4004 series processors. Note from this site: AMD launched the AM5 platform and Zen4 architecture EPYC 4004 series processors in May, offering up to 16-core 3DV-Cache specifications. ASUSProER100AB6 server ASUSProER100AB6 is a 1U rack server product equipped with EPYC Xiaolong 4004 series processor, suitable for the needs of IDC and small and medium-sized enterprises. ASUSExpertCenterProET500AB6 workstation ASUSExpertCenterProET500AB6 is a

Revolutionary GPT-4o: Reshaping the human-computer interaction experience Revolutionary GPT-4o: Reshaping the human-computer interaction experience Jun 07, 2024 pm 09:02 PM

The GPT-4o model released by OpenAI is undoubtedly a huge breakthrough, especially in its ability to process multiple input media (text, audio, images) and generate corresponding output. This ability makes human-computer interaction more natural and intuitive, greatly improving the practicality and usability of AI. Several key highlights of GPT-4o include: high scalability, multimedia input and output, further improvements in natural language understanding capabilities, etc. 1. Cross-media input/output: GPT-4o+ can accept any combination of text, audio, and images as input and directly generate output from these media. This breaks the limitation of traditional AI models that only process a single input type, making human-computer interaction more flexible and diverse. This innovation helps power smart assistants

See all articles