< Day Day Up > |
Allowing for Web-based access to valuable corporate data stored in relational databases makes this data more readily accessible to more people. Companies can obtain a competitive advantage by making their data available to employees over an intranet, or to customers and partners over an extranet. NOTE An intranet is a special Internet adaptation that can only be accessed by internal employees. Likewise, an extranet extends the accessibility in a secure manner only to authorized individuals. One option IBM provides for accessing DB2 data over the Web is called Net.Data. Using Net.Data to Connect to the InternetNet.Data is an IBM product that provides developers the ability to build Web applications using data from DB2 and other enterprise databases. Using Net.Data, you can build interactive Web sites with data included dynamically from a variety of data sources, including relational and non-relational data and flat file data. Net.Data is a macro processor that executes as middleware on a Web server. Using a Web browser and Net.Data, it is possible to rapidly develop applications that use the Internet as a front-end to DB2 databases. Net.Data applications are macro files containing named sections specifying Web page text, HTML, the SQL statement to be executed, programs and scripts to be called, and application control logic. Using Net.Data macros, you can develop programs that access and manipulate variables , call functions, and use report-generating tools. Net.Data processes the macro and produces output that can be displayed by a Web browser. Macros provide the developer with the simplicity of HTML coupled with the advanced functionality of Web server programs. Simply stated, developers can use Net.Data to present data stored in DB2 tables to users in the style of a Web page. This lets savvy Internet users quickly come up to speed at accessing DB2 data. Figure 17.3 outlines the flow of a Net.Data process. The entire flow can be broken down into a simple eight-step process:
Figure 17.3. How Net.Data works.Because Net.Data applications use native HTML and SQL, developers do not need to learn complex new languages and syntax to connect DB2 databases to the Web. Furthermore, SQL SELECT , INSERT , UPDATE , and DELETE statements are supported for both data query and modification. You can use Net.Data to support two-tier and three-tier client/server environments. In a two-tier environment, the database resides on the Internet server and client Web browsers access the data. For DB2 running on OS/390, this is applicable only if you use the mainframe as your Internet server. In a two- tier z/OS environment, Net.Data communicates with DB2 for z/OS through RRS or the Call Attach Facility (CAF). In a three-tier environment, the data can reside on both the local Internet server and a remote platform. This requires DB2 Connect, CAE (Client Application Enabler), or DataJoiner. The three-tier setup is useful when your Internet server is a Unix or Windows NT machine, and you need to access DB2 data from the mainframe. In a three-tier environment, Net.Data macros can access a variety of data sources such as DB2, Oracle, Sybase, and ODBC. In a two-tier environment, Net.Data for z/OS can access DB2 for z/OS and IMS. Net.Data GuidelinesThe following guidelines can help you to implement Net.Data effectively in your organization. Consider Using Stored ProceduresIn addition to regular SQL SELECT , INSERT , UPDATE , and DELETE statements, Net.Data can invoke stored procedures. Consider calling stored procedures to quickly extend the functionality of Net.Data applications. Furthermore, stored procedures use static SQL, which, at times, can provide enhanced performance. Stored procedures also can be used to minimize network traffic. Finally, remember that DB2 stored procedures can return result sets, if necessary. Provide Net.Data Macro Language TrainingNet.Data programs are written in Net.Data's macro language. A Net.Data macro is a mixture of HTML and Net.Data-specific keywords. Although macros can be easy to develop, it is wise to provide an appropriate level of Net.Data macro language training for your Net.Data developers before they develop any Net.Data applications. Net.Data macros can invoke programs written in other languages, such as Perl, REXX, and C. Net.Data also can be used to invoke DB2 stored procedures. Keep in mind that these features can complicate relatively simple Net.Data macros. Enhance Net.Data Using Java Applets and JavaScriptsNet.Data provides Java applet and JavaScript interfaces to enhance the Web client's ability to perform client-side processing. You can use a Java applet to enhance the results of a Net.Data application with graphical elements such as charts and graphs. IBM provides sample Java applets and JavaScripts on the Net.Data Web site at the following link: http://www.ibm.com/software/data/net.data/ Use Direct Requests When PossibleDirect requests improve performance because Net.Data does not have to read and process a macro file. The SQL, ODBC, System, Perl, and REXX Net.Data-supplied language environments support direct requests. Consider Net.Data Live ConnectionsBefore a query can be executed, the process must identify itself and connect to DB2. This can cause performance problems. Net.Data can be used to establish a live connection by continuously running processes to perform the startup tasks . Once started, the process waits to execute subsequent requests. NOTE Live connections are required for API connections, but can be used for CGI connections, too. Use Good Programming TechniquesBe sure to use your standard application development and programming techniques when developing Net.Data macros. Make sure to include comments in the macro file indicating the purpose of the program, as well as a log of changes. Additionally, follow the SQL formulation guidelines covered in Chapters 1, "The Magic Words," and 2, "Data Manipulation Guidelines," and the application programming techniques outlined in Chapter 11, "Using DB2 in an Application Program." Design Web Applications with the User in MindBe aware that the equipment on which you are developing your Web-based applications is probably more state-of-the-art than the equipment on which the application will be used. It is common for developers to have access to high-resolution monitors and a lot of memory. Be sure to test the application on PC setups with less memory and on monitors of varying dot pitch and resolution. Plan Your Security RequirementsWhen developing DB2 applications that are accessible using the Internet, be sure to plan adequate security into the application. Net.Data provides authorization features that should be utilized to ensure that only authorized users are permitted access. Using Java and DB2Java is an increasingly popular language for DB2 application development. Part of its popularity is its ability to make Web applications dynamic. For Java usage guidelines, please refer back to Chapter 14, "Alternative DB2 Application Development Methods." General DB2-Internet GuidelinesThe following guidelines can be applied to DB2 applications that are written to exploit the Internet. Minimize Network TrafficThe biggest potential for degrading the performance of DB2 Internet applications is network traffic. In general, the fewer network calls required to perform the same amount of work, the better performance will be. Consider the following ideas for minimizing network traffic in your DB2-Internet applications:
Keep Up-to-DateMake sure that you are using the most up-to-date versions of software, including JDKs, drivers, and compilers. Running with outdated software likely means that you are forgoing performance upgrades that can be accrued by using the latest versions. |
< Day Day Up > |