| [ directory ] |
|
11.1 IntroductionIn Chapter 10, we discussed the basics of Servlet, JSP, and Cocoon and learned how to develop a practical and secure Web application. In this chapter, we focus on how to represent structured data using XML, store it in a relational database management system (RDBMS), and search for it. The three tier-model of application development that we discussed in Chapter 1 consists of a Web browser or a client application as tier 1, a Web server or an application server as tier 2, and a database system or a transaction system as tier 3, as shown in Figure 11.1. An RDBMS is most frequently used as tier 3 in three-tier systems. Figure 11.1. A three-tier Web application
The debut of Java applets for client-side application development had a big impact in the world. Now, Java has become a very important technology for server-side application development (see Section 10.1.1). XML is also becoming a common format for data exchange among Web applications, and XML Schema languages make it possible to define datatypes and associate them with database tables. This chapter discusses how to design Web applications that access a database and shows many working examples. Java provides a common API for accessing a database system known as Java Database Connectivity (JDBC). It is a part of the Java standard library, and many database vendors supply JDBC drivers that implement this API for accessing their own implementation of database products. Thus JDBC provides a high-level interface to Java programmers and relieves them from dealing with the low-level details of database access. Appendix D explains the basics of JDBC; they are used in most of the sample programs in this chapter. Section 11.3 describes how to map an XML document to relational tables, and Section 11.4 describes how to map relational tables to an XML document. Section 11.5 covers some working examples. Section 11.6 introduces a servlet that accesses a database. We show an approach using Enterprise JavaBeans (EJB) that can reduce programming costs and can develop highly scalable Web applications in Section 11.7. Before moving to these topics, we start with general discussions on storing and searching for an XML document. |
| [ directory ] |
|