Logic in DB
Home Up Logic in DB MySQL Security Fix OLTP


Fast, reliable data access for ODBC, JDBC, ADO.NET and XML
Business Intelligence with R&R ReportWorks
Got SOX compliance?
Movielink Logo 88x31
IBM eserver xSeries 306m 8849 - P4 3.4 GHz
iTunes Logo 88x31-1

Sponsor Links
Fast, reliable data access for ODBC, JDBC, ADO.NET and XML

1 2 3 Next>>

SOA, Multi-Tier Architectures and Logic in the Database

by Ken North

SQL Servers from IBM, Microsoft and Oracle Are Extensible with Database Plug-ins

Programmers, webmasters, Web services developers and database administrators (DBAs) are not strangers to the "Can we have it tomorrow?" request. That's why software and web developers have embraced a continuous stream of silver bullet technologies that promised to accelerate development. The developer community has experienced "web time", object-oriented programming (OOP), rapid application development (RAD), "extreme programming" and "agile development". Accelerated development schedules put a premium on understanding architecture and knowing how to match the tools to the job. That means understanding today's model of applications as services and what role a database can play. If you understand SQL technology, for example, you can adapt databases to application and service requirements by embedding logic in a database.

The computer industry has never been quiet, but recent years have been frenetic as expectations for rapid development increased. The Internet explosion produced a flurry of software-development activity and new technologies appeared overnight. Web time meant rapid innovation, new products, frequent software updates, and a learning curve for developers. It also meant database companies scrambled to support Internet commerce sites with thousands of users.

The explosion of interest in the World Wide Web produced a feeding frenzy and companies rushed to offer web developer suites, as well as connecting legacy applications and databases to the web. Intense competition contributed to the web time phenomenon and it remains a strong influence today in the web and database arenas.

Even as Java APIs, Active Server Pages, Servlets, Java Server Pages, XML and other technologies emerged, leading SQL vendors continued to work on new standards and major architectural changes. There are new messaging technologies for building services and multi-tier, distributed computing architectures for servicing Internet, intranet, or extranet users. The technologies that emerged in the last decade include Internet computing architectures, data access APIs, component transaction servers, stored procedure languages, message queue managers, and remote components. Those have been augmented in recent years by XML and XML messaging, web services, integration technologies, grid computing, semantic web services, and service-oriented architectures (SOA).

Browsers have boosted the audience for business intelligence (BI), online analytical processing (OLAP), data warehousing, data replication, data mining, web farming, and serving up legacy data. There have also been specifications developed for SQL/XML (SQL:2003), embedded SQL for Java (SQLJ), and an XQuery API for Java (XQJ). Besides the XML family of specifications, there are more than 50 specifications related to web services and SOA. All of this means developers must invest a lot of time keeping up with changing technology and standards.

One side effect of web time is the steep learning curve for web and database developers. In this article, we will explore database topics of interest to readers whose mission is to turn database content into web-page content, and vice versa. As we travel the database path, techniques will be our prime directive.

Consider what differentiates a database-enabled web page from a page with no data links. The differences might seem negligible to a web surfer, but the developer must understand more than HTML layout and GIF animation. Database-enabled pages involve logic not required of static pages. Because HTML alone is inadequate to express complex application logic, developers embed queries, scripts, Java applets, or ActiveX controls in their database pages. Those components might still be inadequate, but they are capable of using logic stored in the database. Developers also have the option of encapsulating logic and rules in remote methods and remote objects that sit on application servers.

Web developers working on database projects learn quickly that rendering an HTML page is only part of a larger process that can involve logic on several servers. Part of the developer's job is to understand how to partition the logic (or where to put it). There is no single best solution for distributing the logic of a database application, and the choices are many. We'll start with a quick overview of database-application architectures, a new generation of servers, and options for expressing logic.

Application Architecture, Database Architecture

In the mainframe era, database applications were often monolithic executables. Operating system improvements and modular programming brought dynamic linking and shared libraries. Subsequent developments continued the trend of distributing the logic of database applications. Client/server databases use the client for presentation logic, but they move rules and other business logic into the database for execution at the server. Multi-tier architectures provide even more separation, with additional tiers between the client and database server. The middle tiers include application servers, web servers, and transaction servers, as shown in figure 1. This form of distributed computing permits developers to distribute logic across multiple servers to prevent bottlenecks and provide scalability.

Fig 1: Multi-tier architectures provide scalability by distributing logic across clients and servers.

Figure 1 Multi-tier architectures provide scalability by distributing logic across the client, server, and middle tiers.
(Reprinted by permission from Database Magic with Ken North, Prentice Hall PTR)

Distributed computing and multi-tier architectures have become the predominant model for intranet, extranet, and web developers, with grids becoming more important each day. One of the benefits, or perhaps one of the drawbacks, of the distributed computing model is that application logic is no longer in one large executable. Instead, it's distributed across multiple computers, scripts, out-of-process components, in-process components, and the database. Web developers unfamiliar with databases may be unaware that SQL servers provide a capability for storing logic in the database and executing it at the server. If you create web pages that require persistent data, rules, and other logic that can't be implemented with HTML and scripts, you should consider using a database. An SQL database can store logic and enforce some of your rules about data. Many SQL servers provide that functionality, but the latest generation of database servers enables developers to extend the server with custom logic and custom data types. An XML-enabled database, for example, is an SQL database that can store and retrieve XML documents while preserving information about the document's structure.

If you write Java applets or ActiveX controls, you'll find it's often more efficient to put logic in the database instead of a client-side component. Making applets and controls smaller decreases their download time. Java developers will also find that moving logic out of the client and onto the database server does not mean giving up Java.

1 2 3 Next>>

Database Server Watch SQL Summit Home Page Articles

Visit GridSummit.com (Grid Computing Knowledge Portal) Logo for SQLSummit.com: Database and SQL/XML Portal

1998-2005, Ken North, All rights reserved.