Chapter 8. DB2 Programming Features and Strategies

Database applications provide programmers with the challenge of utilizing DBMS resources efficiently. DB2 provides rich features such as UDFs, stored procedures, concurrency, and transaction management. Using these features properly make the difference between well-tuned applications and headaches such as deadlocks and poor performance.

For example, a remote application that makes dozens of needless queries will suffer a bottleneck in terms of network traffic and DBMS processing time. In contrast, an application that effectively uses DB2 to perform business-logic and function-related tasks saves tremendous client-side overhead, and will see significant performance benefits. One of the keys to success is to experiment and find the right balance that suits your environment.

With the explosion of the Internet and e-business, there are thousands of businesses running Web applications and using DB2 as a backend to manage their data. These applications are generally designed with a three-tier strategy in mind. The client Web browser is the first tier, the Web application running on the Web server is the middle tier, and a DB2 server (usually on a separate system) is the backend. It makes sense in this case to download business functions involving database operations to the DB2 server as much as possible to reduce processing in your Web applications. Computation and data processing are two examples of business functions that can be downloaded in this manner.

This chapter offers strategies to structure your database applications better by utilizing DB2 server-side features. If you are new to database programming or to DB2, you might want to revisit this chapter again after you have read the remainder of the book. We will also teach you general techniques to use in your applications, which are applicable to all programming interfaces, such as using UDFs and casting UDTs.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.68.28