Chapter 29 Web Technology and DBMSs Transparencies Pearson
Chapter 29 Web Technology and DBMSs Transparencies © Pearson Education Limited 1995, 2005 1
Chapter 29 - Objectives u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for integrating databases into Web: – Scripting Languages – Common Gateway Interface (CGI) – HTTP Cookies © Pearson Education Limited 1995, 2005 2
Chapter 29 - Objectives – Extending the Web Server – Java, J 2 EE, JDBC, SQLJ, CMP, JDO, Servlets, and JSP – Microsoft Web Platform: . NET, ASP, and ADO – Oracle Internet Platform. © Pearson Education Limited 1995, 2005 3
Introduction u Web most popular and powerful networked information system to date. u As architecture of Web was designed to be platform-independent, can significantly lower deployment and training costs. u Organizations using Web as strategic platform for innovative business solutions, in effect becoming Web-centric. © Pearson Education Limited 1995, 2005 4
Introduction u Many Web sites today are file-based where each Web document is stored in separate file. u For large sites, this can lead to significant management problems. u Also many Web sites now contain more dynamic information, such as product and pricing data. u Maintaining such data in both a database and in separate HTML files is problematic. u Accessing database directly from Web would be a better approach. © Pearson Education Limited 1995, 2005 5
Internet Worldwide collection of interconnected networks. u Began in late ‘ 60 s in ARPANET, a US DOD project, investigating how to build networks that could withstand partial outages. u Starting with a few nodes, Internet estimated to have over 945 million users by end of 2004. u 2 billion users projected by 2010. u About 3. 5 billion documents on Internet (550 billion if intranets/extranets included). © Pearson Education Limited 1995, 2005 6
Intranet and Extranet u Intranet - Web site or group of sites belonging to an organization, accessible only by members of that organization. u Extranet - An intranet that is partially accessible to authorized outsiders. u Whereas intranet resides behind firewall and is accessible only to people who are members of same organization, extranet provides various levels of accessibility to outsiders. © Pearson Education Limited 1995, 2005 7
e. Commerce and e. Business u e. Commerce - Customers can place and pay for orders via the business’s Web site. u e. Business - Complete integration of Internet technology into economic infrastructure of the business. u Business-to-business transactions may reach $2. 1 trillion in Europe and $7 trillion in US by 2006. u e. Commerce may account for $12. 8 trillion in worldwide corporate revenue by 2006 and could represent 18% of sales in the global economy. © Pearson Education Limited 1995, 2005 8
The Web Hypermedia-based system that provides a simple ‘point and click’ means of browsing information on the Internet using hyperlinks. u Information presented on Web pages, which can contain text, graphics, pictures, sound, and video. u Can also contain hyperlinks to other Web pages, which allow users to navigate in a non-sequential way through information. u Web documents written using HTML. © Pearson Education Limited 1995, 2005 9
The Web u Web consists of network of computers that can act in two roles: – as servers, providing information; – as clients (browsers), requesting information. u Protocol that governs exchange of information between Web server and browser is HTTP and locations within documents identified as a URL. u Much of Web’s success is due to its simplicity and platform-independence. © Pearson Education Limited 1995, 2005 10
Basic Components of Web Environment © Pearson Education Limited 1995, 2005 11
Hyper. Text Transfer Protocol (HTTP) Protocol used to transfer Web pages through Internet. u Based on request-response paradigm: Connection - Client establishes connection with Web server. Request Client sends request to Web server. Response - Web server sends response (HTML document) to client. Close Connection closed by Web server. © Pearson Education Limited 1995, 2005 12
Hyper. Text Transfer Protocol (HTTP) u HTTP/1. 0 is stateless protocol - each connection is closed once server provides response. u This makes it difficult to support concept of a session that is essential to basic DBMS transactions. © Pearson Education Limited 1995, 2005 13
Hyper. Text Markup Language (HTML) Document formatting language used to design most Web pages. u. A simple, yet powerful, platform-independent document language. u HTML is application of Standardized Generalized Markup Language (SGML), a system for defining structured document types and markup languages to represent instances of those document types. © Pearson Education Limited 1995, 2005 14
Hyper. Text Markup Language (HTML) © Pearson Education Limited 1995, 2005 15
Uniform Resource Locators (URLs) String of alphanumeric characters that represents location or address of a resource on Internet and how that resource should be accessed. u Defines uniquely where documents (resources) can be found. u Uniform Resource Identifiers (URIs) - generic set of all Internet resource names/addresses. u Uniform Resource Names (URNs) - persistent, location-independent name. Relies on name lookup services. © Pearson Education Limited 1995, 2005 16
Uniform Resource Locators (URLs) u URL consists of three basic parts: – protocol used for the connection, – host name, – path name on host where resource stored. u Can optionally specify: – port through which connection to host should be made, – query string. http: //www. w 3. org/Markup/Mark. Up. html © Pearson Education Limited 1995, 2005 17
Static and Dynamic Web Pages u HTML document stored in file is static Web page. u Content of dynamic Web page is generated each time it is accessed. u Thus, dynamic Web page can: – respond to user input from browser; – be customized by and for each user. u Requires hypertext to be generated by servers. u Need scripts that perform conversions from different data formats into HTML ‘on-the-fly’. © Pearson Education Limited 1995, 2005 18
Web Services Collection of functions packaged as single entity and published to network for use by other programs. u Web services are important paradigm in building applications and business processes for the integration of heterogeneous applications. u Based on open standards and focus on communication and collaboration among people and applications. u Unlike other Web-based applications, Web services have no user interface and are not targeted for browsers. Instead, consist of reusable software components designed to be consumed by other applications. © Pearson Education Limited 1995, 2005 19
Web Services – Technologies & Standards e. Xtensible Markup Language (XML). u SOAP (Simple Object Access Protocol) protocol, based on XML, used for communication over Internet. u WSDL (Web Services Description Language) protocol, again based on XML, used to describe the Web service. u UDDI (Universal Discovery, Description and Integration) protocol used to register the Web service for prospective users. u © Pearson Education Limited 1995, 2005 20
Web Services u Common example is stock quote facility, which receives a request for current price of a specified stock and responds with requested price. u Second example is Microsoft Map. Point Web service that allows high quality maps, driving directions, and other location information to be integrated into a user application, business process, or Web site. © Pearson Education Limited 1995, 2005 21
Requirements for Web-DBMS Integration u Ability to access valuable corporate data in a secure manner. u Data- and vendor-independent connectivity to allow freedom of choice in DBMS selection. u Ability to interface to database independent of any proprietary browser or Web server. u Connectivity solution that takes advantage of all the features of an organization’s DBMS. © Pearson Education Limited 1995, 2005 22
Requirements for Web-DBMS Integration u Open architecture to allow interoperability with a variety of systems and technologies. For example: – different Web servers; – Microsoft's (Distributed) Common Object Model (DCOM/COM); – CORBA/IIOP (Internet Inter-ORB protocol); – Java/Remote Method Invocation (RMI); – XML; – Web services (SOAP, WSDL, UDDI). u Cost-effective solution that allows for scalability, growth, and changes in strategic directions, and helps reduce applications development costs. © Pearson Education Limited 1995, 2005 23
Requirements for Web-DBMS Integration u Support for transactions that span multiple HTTP requests. u Support for session- and application-based authentication. u Acceptable performance. u Minimal administration overhead. u Set of high-level productivity tools to allow applications to be developed, maintained, and deployed with relative ease and speed. © Pearson Education Limited 1995, 2005 24
Advantages of Web-DBMS Approach u DBMS advantages u Simplicity u Platform independence u Graphical User Interface u Standardization u Cross-platform support u Transparent network access u Scalable deployment u Innovation © Pearson Education Limited 1995, 2005 25
Disadvantages of Web-DBMS Approach u Reliability u Security u Cost u Scalability u Limited functionality of HTML u Statelessness u Bandwidth u Performance u Immaturity of development tools © Pearson Education Limited 1995, 2005 26
Approaches to Integrating Web and DBMSs u Scripting Languages. u Common Gateway Interface (CGI). u HTTP Cookies. u Extending the Web Server. u Java, J 2 EE, JDBC, SQLJ, JDO, Servlets, and JSP. u Microsoft Web Solution Platform: . NET, ASP, and ADO. u Oracle Internet Platform. © Pearson Education Limited 1995, 2005 27
Scripting Languages (Java. Script and VBScript) u Scripting languages can be used to extend browser and Web server with database functionality. u As script code is embedded in HTML, it is downloaded every time page is accessed. u Updating browser is simply a matter of changing Web document on server. u Some popular scripting languages are: Java. Script, VBScript, Perl, and PHP. u They are interpreted languages, not compiled, making it easy to create small applications. © Pearson Education Limited 1995, 2005 28
Common Gateway Interface (CGI) Specification for transferring information between a Web server and a CGI program. u Server only intelligent enough to send documents and to tell browser what kind of document it is. u But server also knows how to launch other programs. u When server sees that URL points to a program (script), it executes script and sends back script’s output to browser as if it were a file. © Pearson Education Limited 1995, 2005 29
CGI - Environment 30 © Pearson Education Limited 1995, 2005
CGI u CGI defines how scripts communicate with Web servers. u A CGI script is any script designed to accept and return data that conforms to the CGI specification. u Before server launches script, prepares number of environment variables representing current state of the server, who is requesting the information, and so on. u Script picks this up and reads STDIN. © Pearson Education Limited 1995, 2005 31
CGI u Then performs necessary processing and writes its output to STDOUT. u Script responsible for sending MIME header, which allows browser to differentiate between components. u CGI scripts can be written in almost any language, provided it supports reading and writing of an operating system’s environment variables. © Pearson Education Limited 1995, 2005 32
CGI u Four primary methods for passing information from browser to a CGI script: – – Passing parameters on the command line. Passing environment variables to CGI programs. Passing data to CGI programs via standard input. Using extra path information. © Pearson Education Limited 1995, 2005 33
CGI - Passing Parameters on Command Line 34 © Pearson Education Limited 1995, 2005
CGI - Advantages u CGI is the de facto standard for interfacing Web servers with external applications. u Possibly most commonly used method for interfacing Web applications to data sources. u Advantages: – – simplicity, language independence, Web server independence, wide acceptance. © Pearson Education Limited 1995, 2005 35
CGI - Disadvantages u Communication between client and database server must always go through Web server. u Lack of efficiency and transaction support, and difficulty validating user input inherited from statelessness of HTTP protocol. u HTTP never intended for long exchanges or interactivity. u Server has to generate a new process or thread for each CGI script. u Security. © Pearson Education Limited 1995, 2005 36
HTTP Cookies u Cookies can make CGI scripts more interactive. u Cookies are small text files stored on Web client. u CGI script creates cookie and has Web server send it to client’s browser to store on hard disk. u Later, when client revisits Web site and uses a CGI script that requests this cookie, client’s browser sends information stored in the cookie. u Cookies can be used to store registration information or preferences (e. g. for virtual shopping cart). u However, not all browsers support cookies. © Pearson Education Limited 1995, 2005 37
Extending the Web Server u To overcome limitations of CGI, many servers provide an API that adds functionality to server. u Two of main APIs are Netscape’s NSAPI and Microsoft’s ISAPI. u Scripts are loaded in as part of the server, giving back-end applications full access to all the I/O functions of server. u One copy of application is loaded and shared between multiple requests to server. © Pearson Education Limited 1995, 2005 38
Extending the Web Server u Approach more complex than CGI, possibly requiring specialized programmers. u Can provide very flexible and powerful solution. u API extensions can provide same functionality as a CGI program, but as API runs as part of the server, API approach can perform significantly better than CGI. u Extending Web server is potentially dangerous, since server executable is being changed. © Pearson Education Limited 1995, 2005 39
Comparison of CGI and API u CGI and API both extend capabilities of server. u CGI scripts run in environment created by Web server program. u Scripts only execute once Web server interprets request from browser, then returns results back to the server. u API approach not nearly so limited in its ability to communicate. u API-based extensions are loaded into same address space as Web server. © Pearson Education Limited 1995, 2005 40
Java u Proprietary language developed by Sun. u Originally intended to support environment of networked machines and embedded systems. u Now, Java is rapidly becoming de facto language for Web computing. u Interesting because of its potential for building Web applications (applets) and server applications (servlets). © Pearson Education Limited 1995, 2005 41
Java ‘A simple, object-oriented, distributed, interpreted, robust, secure, architecture neutral, portable, high-performance, multi-threaded and dynamic language’. u Has a machine-independent target architecture, the Java Virtual Machine (JVM). u Since almost every Web browser vendor has already licensed Java and implemented an embedded JVM, Java applications can currently be deployed on most end-user platforms. © Pearson Education Limited 1995, 2005 42
Java 43 © Pearson Education Limited 1995, 2005
Java u Before Java application can be executed, it must first be loaded into memory. u Done by Class Loader, which takes ‘. class’ file(s) containing bytecodes and transfers it into memory. u Class file can be loaded from local hard drive or downloaded from network. u Finally, bytecodes must be verified to ensure that they are valid and do not violate Java’s security restrictions. © Pearson Education Limited 1995, 2005 44
Java u Loosely speaking, Java is a ‘safe’ C++. u Safety features include strong static type checking, automatic garbage collection, and absence of machine pointers at language level. u Safety is central design goal: ability to safely transmit Java code across Internet. u Security is also integral part of Java’s design sandbox ensures untrusted application cannot gain access to system resources. © Pearson Education Limited 1995, 2005 45
Java 2 Platform u In mid-1999, Sun announced it would pursue a distinct and integrated Java enterprise platform: – J 2 ME: aimed at embedded and consumer-electronics platforms. – J 2 SE: aimed at typical desktop and workstation environments. Serves as foundation for J 2 EE and Web services. – J 2 EE: aimed at robust, scalable, multiuser, and secure enterprise applications. u J 2 EE was designed to simplify complex problems with development, deployment, and management of multi-tier enterprise applications. © Pearson Education Limited 1995, 2005 46
Java 2 Platform 47 © Pearson Education Limited 1995, 2005
Java 2 Platform u Cornerstone of J 2 EE is Enterprise Java. Beans (EJB), a standard for building server-side components in Java. u Three types of EJB components: – EJB Session Beans, components implementing business logic, business rules, and workflow. – EJB Message-Driven Beans (MDBs), which process messages sent by clients, EJBs, or other J 2 EE components. – EJB Entity Beans, components encapsulating some data contained by the enterprise. Entity Beans are persistent. © Pearson Education Limited 1995, 2005 48
Java 2 Platform u Two types of entity beans: – Bean-Managed Persistence (BMP), which requires developer to write code top make bean persist using an API such as JDBC or SQLJ. – Container-Managed Persistence (CMP), where persistence is provided automatically by container. u Discuss 5 ways to access a database: JDBC, SQLJ, CMP, JDO, and JSP. © Pearson Education Limited 1995, 2005 49
JDBC u Modeled after ODBC, JDBC API supports basic SQL functionality. u With JDBC, Java can be used as host language for writing database applications. u On top of JDBC, higher-level APIs can be built. u Currently, two types of higher-level APIs: – An embedded SQL for Java (e. g. SQLJ). – A direct mapping of relational database tables to Java classes (e. g. Top. Link from Oracle). © Pearson Education Limited 1995, 2005 50
JDBC u JDBC API consists of two main interfaces: an API for application writers, and a lower-level driver API for driver writers. u Applications and applets can access databases using: – ODBC drivers and existing database client libraries; – JDBC API with pure Java JDBC drivers. © Pearson Education Limited 1995, 2005 51
JDBC 52 © Pearson Education Limited 1995, 2005
JDBC - Advantages/Disadvantages u Advantage of using ODBC drivers is that they are a de facto standard for PC database access, and are available for many DBMSs, for very low price. u Disadvantages with this approach: – Non-pure JDBC driver will not necessarily work with a Web browser. – Currently downloaded applet can connect only to database located on host machine. – Deployment costs increase. © Pearson Education Limited 1995, 2005 53
SQLJ u Another JDBC-based approach uses Java with static embedded SQL. u SQLJ comprises a set of clauses that extend Java to include SQL constructs as statements and expressions. u SQLJ translator transforms SQLJ clauses into standard Java code that accesses database through a CLI. © Pearson Education Limited 1995, 2005 54
Comparison of JDBC and SQLJ u SQLJ is based on static embedded SQL while JDBC is based on dynamic SQL. u Thus, SQLJ facilitates static analysis for syntax checking, type checking, and schema checking, which may help produce more reliable programs at loss of some functionality. u It also potentially allows DBMS to generate an execution strategy for the query, thereby improving performance of the query. © Pearson Education Limited 1995, 2005 55
Comparison of JDBC and SQLJ JDBC is low-level middleware tool with features to interface Java application with RDBMS. u Developers need to design relational schema to which they will map Java objects, and write code to map Java objects to rows of relations. u Problems: u – need to be aware of two different paradigms (object and relational); – need to design relational schema to map onto object design; – need to write mapping code. © Pearson Education Limited 1995, 2005 56
EJBs u u EJBs have 3 elements in common: – an indirection mechanism; – a bean implementation; – a deployment description. With indirection mechanism clients do not invoke EJB methods directly. Session and entity beans provide access to their operations via interfaces. home interface defines methods that manage lifecycle of a bean. The corresponding server-side implementation classes are generated at deployment time. © Pearson Education Limited 1995, 2005 57
EJBs u To provide access to other operations, bean can expose a local interface (if client and bean are colocated), a remote interface, or both. u Local interfaces expose methods to clients running in same container or JVM. u Remote interfaces make methods available to clients no matter where deployed. u When a client invokes create() method (which returns an interface) on home interface, EJB container calls ejb. Create() to instantiate bean, at which point client can access bean through remote or local interface returned by create(). © Pearson Education Limited 1995, 2005 58
EJBs © Pearson Education Limited 1995, 2005 59
EJBs Bean implementation is a Java class that implements business logic defined in remote interface. u Transactional semantics are described declaratively and captured in the deployment descriptor. u Deployment descriptor, written in XML, lists a bean’s properties and elements, which may include: – home interface, remote interface, local interface; – Web service endpoint interface, – bean implementation class, – JNDI name for bean, transaction attributes, security attributes, and per-method descriptors. u © Pearson Education Limited 1995, 2005 60
Container-Managed Persistence (CMP) u Instead of writing Java code to implement BMP, CMP is defined declaratively in deployment descriptor. u At runtime, container manages bean’s data by interacting with data source designated in deployment descriptor. u Following steps need to be followed for CMP: – – Define CMP fields in local interface. Define CMP fields in entity bean class implementation. Define CMP fields in deployment descriptor. Define PK field and its type in deployment descriptor. © Pearson Education Limited 1995, 2005 61
Container-Managed Relationships (CMR) u EJB container can manage relationships between entity beans and session beans. u Relationships have a multiplicity, which can be 1: 1, 1: M, or M: M, and a direction, which can be unidirectional or bidirectional. u Local interfaces provide foundation for CMR. u With CMR, beans use local interfaces to maintain relationships with other beans. u For example, a Staff bean can use collection of Property. For. Rent local interfaces to maintain a 1: M relationship u Container can also manage referential integrity. © Pearson Education Limited 1995, 2005 62
Container-Managed Relationships (CMR) u CMR relationships are described declaratively in deployment descriptor file outside enterprise-beans element. u Need to specify both beans involved in relationship. u Relationship is defined in ejb-relations element, with each role defined in ejb-relationship-role element. u When bean is deployed, the container provider’s tools parse deployment descriptor and generate code to implement underlying classes. © Pearson Education Limited 1995, 2005 63
EJB Query Language (EJB-QL) u Used to define queries for entity beans that operate with CMP. EJB-QL can express queries for two different styles of operations: – finder methods, which allow results of an EJB-QL query to be used by clients of the entity bean. Finder methods are defined in home interface. – select methods, which find objects or values related to state of an entity bean without exposing results to client. Select methods are defined in entity bean class. u An object-based approach for defining queries against persistent store; conceptually similar to SQL. © Pearson Education Limited 1995, 2005 64
EJB Query Language (EJB-QL) u As with CMP and CMR fields, queries are defined in the deployment descriptor. u EJB container is responsible for translating EJBQL queries into query language of persistent store, resulting in query methods that are more flexible. <query> <query-method> <method-name>find. All</method-name> <method-params></method-params> </query-method> <result-type-mapping>Local</result-type-mapping> <ejb-ql><![CDATA[SELECT OBJECT(s) FROM Staff s]]></ejb-ql> </query> © Pearson Education Limited 1995, 2005 65
EJB Query Language (EJB-QL) <query> <query-method> <method-name>find. By. Staff. Name</method-name> <method-params>java. lang. String</method-params> </query-method> <result-type-mapping>Local</result-type-mapping> <ejb-ql><![CDATA[SELECT OBJECT(s) FROM Staff s WHERE s. name = ? 1]]> </ejb-ql> </query> © Pearson Education Limited 1995, 2005 66
Java Data Objects (JDO) u ODMG submitted their Java binding to Java Community Process as basis of JDO. Development of JDO had two major aims: – To provide standard interface between application objects and data sources, such as relational databases, XML databases, legacy databases, and file systems. – To provide developers with a transparent Java-centric mechanism for working with persistent data to simplify application development. (Aim of JDO was to reduce need to explicitly code such things as SQL statements and transaction management into applications). © Pearson Education Limited 1995, 2005 67
Java Data Objects (JDO) - Interfaces u u Persistence. Capable makes a Java class capable of being persisted by a persistence manager. Every class whose instances can be managed by a JDO Persistence. Manager must implement this interface. Most JDO implementations provide an enhancer that transparently adds code to implement this interface to each persistent class. The interface defines methods that allow an application to examine runtime state of an instance and to get its associated Persistence. Manager if it has one. Persistence. Manager. Factory obtains Persistence. Manager instances. PMF instances can be configured and serialized for later use. © Pearson Education Limited 1995, 2005 68
Java Data Objects (JDO) - Interfaces u u Persistence. Manager contains methods to manage the lifecycle of Persistence. Capable instances and is also the factory for Query and Transaction instances. A Persistence. Manager instance supports one transaction at a time and uses one connection to the underlying data source at a time. Query allows applications to obtain persistent instances from data source. Can be many Query instances associated with a Persistence. Manager and multiple queries may be designated for simultaneous execution. This interface is implemented by each JDO vendor to translate expressions in JDOQL into native query language of data store. © Pearson Education Limited 1995, 2005 69
Java Data Objects (JDO) – Interfaces and Classes u u u Extent is a logical view of all objects of a particular class that exist in the data source. Extents are obtained from a Persistence. Manager and can be configured to also include subclasses. Extent has two possible uses: (a) to iterate over all instances of a class; (b) to execute a query in the data source over all instances of a particular class. Transaction contains methods to mark start/end of transactions. JDOHelper class defines static methods that allow a JDOaware application to examine runtime state of instances and to get its associated Persistence. Manager if it has one. © Pearson Education Limited 1995, 2005 70
JDO – Creating Persistent Classes 1. 2. 3. Ensure each class has a no-arg constructor. If class has no constructors defined, complier automatically generates a no-arg constructor; otherwise, developer will need to specify one. Create a JDO metadata file to identify the persistent classes. The JDO metadata file is expressed as an XML document. Enhance classes so that they can be used in a JDO runtime environment. JDO specification describes a number of ways that classes can be enhanced, however, most common way is using an enhancer program that reads a set of. class files and JDO metadata file and creates new. class files that have been enhanced to run in a JDO © Pearson Education Limited 1995, 2005 environment. 71
JDO – Reachability-based Persistence u u u JDO supports reachability-based persistence. Thus, any transient instance of a persistent class will become persistent at commit if it is reachable, directly or indirectly, by a persistent instance. Instances are reachable through either a reference or collection of references. Reachability algorithm is applied to all persistent instances transitively through all their references to instances in memory, causing the complete closure to become persistent. Allows developers to construct complex object graphs in memory and make them persistent simply by creating a reference to graph from a persistent instance. Instances have to be explicitly deleted. © Pearson Education Limited 1995, 2005 72
JDO Query Language (JDOQL) u Data source-neutral query language based on Java boolean expressions. u Syntax is same as standard Java syntax, with a few exceptions. u A Query object is used to find persistent objects matching certain criteria. A Query is obtained through one of new. Query() methods of Persistence. Manager. u Basic JDOQL query has following 3 components: – a candidate class (usually a persistent class); – a candidate collection containing persistent objects (usually an Extent); – a filter, a boolean expression in a Java-like syntax. © Pearson Education Limited 1995, 2005 73
JDO Query Language (JDOQL) u Query result is a subcollection of candidate collection containing only those instances of candidate class that satisfy filter. u Queries can include optional parameter declarations that act as placeholders in filter string, variable declarations, imports, and ordering expressions. Query query = pm. new. Query(Property. For. Rent. class, “this. rent < 400”); Collection result = (Collection) query. execute(); © Pearson Education Limited 1995, 2005 74
Java Servlets u Servlets are programs that run on Java-enabled Web server and build Web pages, analogous to CGI. u Have a number of advantages over CGI: – – – improved performance; portability; extensibility; simpler session management; improved security and reliability. © Pearson Education Limited 1995, 2005 75
Java Server Pages (JSP) u Java-based server-side scripting language that allows static HTML to be mixed with dynamically -generated HTML. u Compiled into Java servlet and processed by a Java-enabled Web server (JSP works with most Web servers). u Since servlet is compiled, performance is improved. © Pearson Education Limited 1995, 2005 76
Java Web Services – Document-Oriented u Deal directly with processing XML documents. u Java API for XML Processing (JAXP), processes XML documents using various parsers and transformations. JAXP supports both SAX and DOM. Also supports the XSLT. u Java Architecture for XML Binding (JAXB), processes XML documents using schema-derived Java. Beans component classes. JAXB provides methods for unmarshalling an XML instance document into a tree of Java objects, and marshalling tree back into an XML document. © Pearson Education Limited 1995, 2005 77
Java Web Services – Document-Oriented u SOAP with Attachments API for Java (SAAJ), provides standard way to send XML documents over Internet from Java platform. Based on SOAP 1. 1 and SOAP with Attachments, which define a basic framework for exchanging XML messages. © Pearson Education Limited 1995, 2005 78
Java Web Services – Procedure-Oriented u Java API for XML-based RPC (JAX-RPC), sends SOAP method calls to remote clients over Internet and receives results. u Client written in language other than Java can access a Web service developed and deployed on Java platform. u Also, client written in Java can communicate with service developed and deployed using some other platform. © Pearson Education Limited 1995, 2005 79
Java Web Services – Procedure-Oriented u Java API for XML Registries (JAXR), provides standard way to access business registries and share information. u JAXR gives Java developers a uniform way to use business registries based on open standards (such as eb. XML) or industry consortium-led specifications (such as UDDI). © Pearson Education Limited 1995, 2005 80
Microsoft Web Platform -. NET “Software is delivered as a service, accessible by any device, any time, any place, and is fully programmable and personalizable. ” u Contains various tools, services, and technologies, such as: – – – Windows 2000, Exchange Server, Visual Studio, HTML/XML, scripting languages, components (Java, Active. X). © Pearson Education Limited 1995, 2005 81
Object Linking and Embedding for Data. Bases (OLE DB) u Microsoft has defined set of data objects, collectively known as OLE DB. u Allows OLE-oriented applications to share and manipulate sets of data as objects. u OLE DB is an object-oriented specification based on C++ API. u Components can be treated as data consumers and data providers. Consumers take data from OLE DB interfaces and providers expose OLE DB interfaces. © Pearson Education Limited 1995, 2005 82
OLE DB Architecture © Pearson Education Limited 1995, 2005 83
Active Server Pages (ASP) u ASP is programming model that allows dynamic, interactive Web pages to be created on server. u ASP provides flexibility of CGI, without performance overhead discussed previously. u ASP runs in-process with the server, and is optimized to handle large volume of users. u When an ‘. asp’ file is requested, Web server calls ASP, which reads requested file, executes any commands, and sends generated HTML page back to browser. © Pearson Education Limited 1995, 2005 84
Active Server Pages (ASP) © Pearson Education Limited 1995, 2005 85
Active. X Data Objects (ADO) u Programming extension of ASP supported by Microsoft IIS for database connectivity. u Supports following key features: – – – Independently-created objects. Support for stored procedures. Support for different cursor types. Batch updating. Support for limits on number of returned rows. Support for multiple recordsets. u Designed as an easy-to-use interface to OLE DB. © Pearson Education Limited 1995, 2005 86
ADO Object Model 87 © Pearson Education Limited 1995, 2005
Remote Data Services (RDS) u Microsoft technology for client-side database manipulation across Internet. u Still uses ADO on server-side to execute query and return recordset to client, which can then execute other queries on recordset. u RDS provides mechanism to send updated records back to server. u A disconnected recordset model. © Pearson Education Limited 1995, 2005 88
Comparison of ASP and JSP u Both designed to enable developers to separate page design from programming logic through use of callable components. u Differences: – JSP is essentially platform and server independent whereas ASP primarily restricted to MS Windowsbased platforms. – JSP perhaps more extensible as JSP developers can extend the JSP tags available. – JSP components are reusable across platforms. – JSP benefits from in-built Java security model. © Pearson Education Limited 1995, 2005 89
Microsoft. NET u Number of limitations with Microsoft’s platform: – a number of languages supported with different programming models (J 2 EE composed solely of Java); – no automatic state management; – relatively simple user interfaces for Web compared to traditional Windows user interfaces; – need to abstract operating system (Windows API difficult to program). u Next, and current, evolution in Microsoft’s Web solution strategy was development of. NET. © Pearson Education Limited 1995, 2005 90
Microsoft. NET u Various tools, services, technologies in. NET: – Windows Server, – Biz. Talk Server (to build XML-based business processes across applications and organizations), – Commerce Server (to build scalable e-Commerce solutions), – Application Center (to deploy and manage scalable Web applications), – Mobile Information Server (to support handheld devices), – SQL Server, – Microsoft Visual Studio. NET – Microsoft. NET Framework (CLR + Class Library). © Pearson Education Limited 1995, 2005 91
. NET Framework 92 © Pearson Education Limited 1995, 2005
. NET – Common Language Runtime u An execution engine that loads, executes, and manages code compiled into an intermediate bytecode format - Microsoft Intermediate Language (MSIL) - analogous to Java bytecodes. u Not interpreted but compiled to native binary format before execution by a JIT compiler built into CLR. u Allows one language to call another, and even inherit and modify objects from another language. © Pearson Education Limited 1995, 2005 93
. NET – Common Language Runtime u u u Provides number of services such as memory management, code and thread execution, uniform error handling, and security. Enforces strict type-and-code-verification system called common type system (CTS), which contains range of prebuilt data types representing both simple data types for objects such as numbers and text values, and more complex data types for developing user interfaces, data systems, file management, graphics, and Internet services. Also supports side-by-side execution allowing application to run on single computer that has multiple versions of. NET Framework installed, without application being affected. © Pearson Education Limited 1995, 2005 94
. NET Framework Class Library u u Collection of reusable classes, interfaces, and types that integrate with CLR providing standard functionality such as: – string management, input/output, security management, – network communications, thread management, – user interface design features, – database access and manipulation. 3 main components: – Windows Forms to support user interface development. – ASP. NET to support development of Web applications and Web services. Reengineered version of ASP to improve performance and scalability. – ADO. NET to help applications connect to databases. © Pearson Education Limited 1995, 2005 95
ADO. NET u Designed to address 3 main weaknesses with ADO: – providing a disconnected data access model required for Web; – providing compatibility with. NET Framework class library; – providing extensive support for XML. u Different from connected style of programming that existed in traditional 2 -tier C-S architecture, where connection was held open for duration of program’s lifetime and no special handling of state was required. © Pearson Education Limited 1995, 2005 96
ADO. NET u u u Also ADO data model is primarily relational and could not easily handle XML with a data model that is heterogeneous and hierarchical. Recognizing that ADO was a mature technology and widely used, ADO has been retained in the. NET Framework, accessible through the. NET COM interoperability services. Two main layers: – a connected layer (similar to ADO); – a disconnected layer, the Data. Set (providing a similar functionality to RDS). © Pearson Education Limited 1995, 2005 97
ADO. NET © Pearson Education Limited 1995, 2005 98
ADO. NET Object Model 99 © Pearson Education Limited 1995, 2005
ADO. NET u Main replacements for ADO Recordset are: – Data. Adapter, acts as bridge between vendor-dependent data source and vendor-neutral Data. Set. While data source may be RDB, may also be an XML document. – Data. Reader, provides connected, forward-only, readonly stream of data from data source. A Data. Reader can be used independently of a Data. Set for increased performance. – Data. Set, provides disconnected copies of records from data source. Data. Set stores records from one or more tables in memory without holding a connection to the data source, but unlike RDS Data. Set maintains information on relationships between tables and constraints. © Pearson Education Limited 1995, 2005 100
ADO. NET u Several ways a Data. Set can be used: – user can create Data. Table, Data. Relation, and Constraint within Data. Set and populate table with data programmatically. – user can populate Data. Set with data from existing relational data source using a Data. Adapter. – contents of Data. Set can be loaded from an XML stream or document, which can be either data, XML schema information, or both. u Also, a Data. Set can be made persistent using XML (with or without a corresponding XML Schema). © Pearson Education Limited 1995, 2005 101
Microsoft Web Services u u . NET Framework built on number of standards to promote interoperability with non-Microsoft solutions. For example, Visual Studio. NET automatically creates necessary XML and SOAP interfaces required to turn application into a Web service. In addition, . NET Framework provides set of classes that conform to all the underlying communication standards, such as SOAP, WSDL, and XML. Microsoft UDDI SDK enables developers to add UDDI functionality to development tools, installation programs, and any other software that needs to register or locate and bind remote Web services. © Pearson Education Limited 1995, 2005 102
Microsoft Access and Web Page Generation u Access provides wizards generating HTML/XML: for automatically – Static pages: user can export data to HTML format. – Dynamic pages using ASP: user can export data to an ‘asp’ file on Web server. – Dynamic pages using HTX/IDC files: user can export data to HTX/IDC files on server. – Dynamic pages using data access pages: data access pages are Web pages bound directly to data in the database. Can be used like Access forms, except pages are stored as external files. – XML: data can be output as an XML document along with associated schema and an XSL file. © Pearson Education Limited 1995, 2005 103
Oracle Internet Platform u Comprises Oracle Application Server and Oracle DBMS. u It is n-tier architecture based on industry standards such as: – HTTP and HTML/XML for Web enablement. – Java, J 2 EE, EJB, JDBC, and SQLJ for database connectivity, Java servlets, and JSP. Also supports JNDI and stored Java procedures. – OMG’s CORBA technology. – IIOP for object interoperability and RMI. – Web services: SOAP, WSDL, UDDI, eb. XML, Web. Dav, LDAP. © Pearson Education Limited 1995, 2005 104
Oracle Internet Platform 105 © Pearson Education Limited 1995, 2005
Oracle Application Server (Oracle. AS) u. A reliable, scalable, secure, middle-tier application server designed to support e. Business. u Currently available in three versions: – Java Edition: lightweight Web server with minimal application support; – Standard Edition: for medium to large Web sites that handle large volume of transactions; – Enterprise Edition: Standard Edition + extras. © Pearson Education Limited 1995, 2005 106
Communication Services u Handles all incoming requests received by Oracle. AS, some processed by Oracle HTTP Server and some by other areas of Oracle. AS. u Oracle HTTP Server is extended version of Apache Server. © Pearson Education Limited 1995, 2005 107
Oracle HTTP Server Modules (mods) u Oracle has enhanced several of Apache mods, and has added Oracle-specific ones; e. g. : – mod_oc 4 j, routes HTTP requests for J 2 EE to Oracle. AS Containers for J 2 EE (OC 4 J); – mod_plsql, routes requests for stored procedures to database server; – mod_fastcgi, enhanced version of CGI that runs programs in pre-spawned process; – mod_oradav, provides support for Web. DAV; – mod_ossl, provides standard S-HTTP; – mod_osso, enables transparent single sign-on. © Pearson Education Limited 1995, 2005 108
Oracle. AS Containers for J 2 EE (OC 4 J) u u A fully compliant J 2 EE 1. 3 server. Runs on J 2 SE and executes and manages J 2 EE application components such as: – Servlets Servlet container provided that manages execution of Web components and J 2 EE applications. – JSPs JSP translator provided to convert JSP files into Java source that container can then compile and execute as a servlet. – EJBs EJB container provided that manages execution of EJBs for J 2 EE applications. Container has configurable settings that customize the underlying support , such as security, transaction management, JNDI lookups, and remote connectivity. Container also manages EJB lifecycles, database connection resource pooling, data persistence, and access to J 2 EE APIs. © Pearson Education Limited 1995, 2005 109
Oracle. AS Containers for J 2 EE (OC 4 J) u Oracle. AS supports both JDBC and SQLJ database access mechanisms, drivers: and provides following – Oracle JDBC drivers, for use with Oracle database. Have extensions to support Oracle-specific datatypes and to enhance their performance. – J 2 EE Connectors, part of J 2 EE platform, provide a Java -based solution for connecting various application servers and EISs. – Data. Direct Connect Type 4 JDBC drivers, for connecting to non-Oracle databases. © Pearson Education Limited 1995, 2005 110
Business Components for Java (BC 4 J) u. A Java and XML framework that enables development, deployment, and customization of multi-tier database applications from reusable business components. u Application developers can use BC 4 J to author and test business logic in components that automatically integrate with databases, reuse business logic through SQL-based views, and access/update these views from servlets, JSP, and Java Swing clients. u Applications can be deployed as either EJB Session Beans or CORBA objects on Oracle. AS. © Pearson Education Limited 1995, 2005 111
Presentation Services u These services deliver dynamic content to client browsers, supporting servlets, JSP, Perl/CGI scripts, PL/SQL pages, forms, and business intelligence. – Oracle Forms Services, to run Oracle Forms over Internet; – Oracle. JSP, an implementation of Sun’s JSP; – Oracle PSP (PL/SQL Server Pages), analogous to JSP, but uses PL/SQL rather than Java for the server-side scripting. – Perl Interpreter, a persistent Perl runtime embedded in Oracle HTTP Server. © Pearson Education Limited 1995, 2005 112
Web Services and XML Support u Oracle. AS provides facilities for developing, deploying, and managing Web services; e. g. : – Web services can be developed using stateless and stateful Java classes, stateless session EJBs, and stateless PL/SQL stored procedures. – Web Service HTML/XML Streams Processing Wizard assists developers in creating an EJB whose methods access and process HTML or XML streams. – Web services can be integrated into both enterprise and wireless portals, other Web services, databases, legacy systems, and applications. – Oracle. AS supports SOAP, WSDL, and UDDI. © Pearson Education Limited 1995, 2005 113
Top. Link u. A persistence framework that includes an objectrelational mapping mechanism for storing Java objects and EJBs in a RDB. u Provides solution to address complex differences between Java objects and RDBs and enables applications to store persistent Java objects in any RDB supported by a JDBC driver. u Includes Mapping Workbench, a visual tool to map any object model to any relational schema. © Pearson Education Limited 1995, 2005 114
Oracle Portal u A portal is Web-based application that provides a common, integrated entry point for accessing dissimilar data types on a single Web page. u A portal is divided into a number of portlets. u Oracle Portal provides a number of tools to generate and customize portals and portlets. © Pearson Education Limited 1995, 2005 115
Oracle Wireless Provides services and tools for delivering information and applications to mobile devices. u Includes Multi-Channel Server (MCS) that supports development of applications that are accessible from multiple channels including wireless browsers, voice, and messaging. u MCS automatically translates applications written in Oracle Wireless XML, XHTML Mobile Profile, or XHTML+XForms for any device and network. u Also allows portal sites to be created that use Web pages, Java applications, and XML-based applications. u © Pearson Education Limited 1995, 2005 116
Business Intelligence u Functions to track, extract, and analyze business intelligence to support strategic decision-making: – Oracle Reports Services enable users to run Oracle Reports over Internet. – Oracle Discoverer allows users to produce queries, reports, and analysis of information from databases, OLTP systems, and data warehouses using a Web browser. – Oracle Clickstream provides services to capture and analyze aggregate information about Web site usage. – Oracle Personalization enables users to track activity of specific user and personalize information for that user. © Pearson Education Limited 1995, 2005 117
- Slides: 117