Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Optimize your existing JDBC applications using pureQuery

Improve security and performance for existing JDBC applications

Patrick Titzler (ptitzler@us.ibm.com), Enablement Engineer, IBM
Patrick Titzler
Patrick Titzler is an engineer in the Data Studio Enablement team at IBM's Silicon Valley Lab in San Jose, CA, and focuses on the application development components of the Data Studio portfolio. Prior to joining this team, Patrick was a member of Data Warehousing and OLAP application development teams. Patrick holds a Master's degree in Computer Science from University of Rostock, Germany.
Zeus Courtois (zocourto@us.ibm.com), Software Engineer, Systems Documentation, Inc. (SDI)
Zeus Courtois
Zeus Courtois is a Software Engineer in the Data Studio Development team working on the pureQuery tools at IBM Silicon Valley Lab in San Jose, California. Before joining this team, Zeus was an intern in the Data Studio Enablement team. Zeus holds a Masters degree in Information Systems from Texas A&M International University.

Summary:  In Version 1.2, Data Studio Developer and Data Studio pureQuery Runtime include a new feature called client optimization that enables DBAs and developers to take advantage of the benefits of static SQL execution without having to modify their existing custom-developed, framework-based, or packaged JDBC applications. This tutorial shows you how to use the tooling provided by Data Studio Developer to enable a JDBC application to use this new capability.

Date:  21 Aug 2008
Level:  Introductory PDF:  A4 and Letter (2248 KB | 45 pages)Get Adobe® Reader®

Activity:  12331 views
Comments:  

Before you start

Introducing pureQuery

The IBM Data Studio portfolio includes pureQuery, which is a high-performance, data access platform to simplify developing, managing, securing, and optimizing Java data access. It consists of development tools (delivered in Data Studio Developer), a simple and intuitive API, and a runtime (delivered in Data Studio purequery Runtime).

One of the major benefits of pureQuery in regards to optimizing and securing Java data access to DB2 data is how easy it is to develop and deploy applications that use static SQL. With static SQL, the preparation steps for executing a SQL statement occur before the application is ever executed, thus offering the opportunity for better performance at runtime. In addition, static SQL, which is always known ahead of time, is not susceptible to malicious or accidental SQL injections, a known security flaw with dynamic SQL. For more information about the performance and security benefits of static SQL, see Resources.

Previously, you needed to write your application in the pureQuery annotated-method style to use static SQL. In Version 1.2 of Data Studio Developer and Data Studio pureQuery Runtime, you can use static SQL on existing JDBC application, without having to rewrite your code, regardless of whether they implement persistence directly or use popular frameworks, such as Hibernate and JPA. This feature is sometimes called client optimization because the process for enabling the static capability occurs at the JDBC client level. We will simply call this pureQuery for JDBC applications.

The general process of enabling an application for pureQuery for JDBC applications is an iterative process consisting of the following phases:

  • Planning. The purpose of the planning phase is to determine whether an application is a suitable candidate for pureQuery enablement. Even though it is conceptually possible to enable any Java application that accesses data in any DB2 data server, there are certain criteria that have to be met such as prerequisites (for example, the application runs in JRE 1.5 or above), security aspects (for example, that the DBA or data steward agrees with using database package-based security instead of table/view-based security), and so on.
  • Capture. PureQuery for JDBC applications relies on information about the applications' SQL statements and its associated metadata to process them statically. During the capture phase, the necessary information is gathered and stored in a metadata file.
  • Configure. To execute SQL statically, it must first be bound to a database package. Before you do that, you can configure the captured SQL file to specify, for example, how many SQL statements go into each package.
  • Bind. After the package characteristics have been defined, you bind the captured SQL and its enriched metadata to one or more databases. (You can also store it into a DBRM and deploy it later.)
  • Execution and validation. Upon successful completion of the previous phases, pureQuery for JDBC applications is configured to execute SQL statements statically. As part of validation, a quality assurance professional verifies that the application behaves as desired and returns the expected results.

What is a database package? DBRM?

A database package (not to be confused with a Java package) is the object that contains all the information that is required for DB2 to run the SQL statements included in that package. The process to create packages is called a bind, and that is when DB2 does such things as determine the access paths for each SQL statement associated with a particular package.

A DBRM is something DB2 for z/OS users are familiar with. It consists of SQL statements that are ready to be bound into a package. In the context of client optimization, you can tell the binder utility to create a DBRM from the captured XML and then bind it on the associated z/OS system later.

Note: The enablement process in a typical usage scenario is an iterative process.


About this tutorial

In this tutorial, learn how to use Data Studio Developer to enable a simple custom-developed JDBC application that is included in this tutorial. However, you can also follow this tutorial using an application of your choice that accesses DB2 data on any platform. Access to source code is not required for client optimization, but the steps in this tutorial assume you have such access.


Objectives

The objective of this tutorial is to introduce you to the process of enabling an existing JDBC application for pureQuery. To keep this tutorial simple, we've supplied you with a small application that implements its persistence directly using JDBC, meets all enablement requirements, and can be easily validated.

In this tutorial you will learn how to:

  • Create a sample database and import the sample JDBC application into Data Studio Developer 1.2
  • Run the application using one code path and capture its SQL
  • Optionally, browse the sample application's SQL and its relationship to the Java source code
  • Configure and bind the captured SQL to a database package
  • Run the sample application in static SQL execution mode, and validate its correct behavior
  • Run the application using another code path to capture the remaining SQL; then rebind and re-run the application using static SQL execution

Prerequisites

This tutorial is written for application developers and DBAs who have basic experience with Eclipse-based tooling.


System requirements

To run the examples in this tutorial, you should have Data Studio Developer 1.2 installed. You will also need access to a DB2 data server. Download the DB2 Express-C no-charge version of DB2 for the community that offers the same core data features as DB2 LUW and provides a solid base to build and deploy applications. Refer to the Resources section for download links.

1 of 10 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management, Java technology
ArticleID=332504
TutorialTitle=Optimize your existing JDBC applications using pureQuery
publish-date=08212008
author1-email=ptitzler@us.ibm.com
author1-email-cc=
author2-email=zocourto@us.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.