With pureQuery, you can write Java™ applications
that treat relational data as objects. Your applications can also
treat objects that are stored in in-memory Java collections as though those objects are
relational data. To query or update your relational data or Java objects, you can use a single,
well-known, and widely used language: SQL.
- Allows you to run SQL against databases, in-memory collections,
and Iterator objects by using a single API
The Java platform provides
a multitude of data structures and API's for processing in-memory
collections as well as external data from a variety of sources. Each
of these is generally suited perfectly for solving a specific type
of problem but also has a unique set of interfaces for retrieving
and modifying the data within the collections. Java Arrays, Lists, Maps and Iterators for example,
each provide an API for querying and in some cases updating the data
in the collection.
Similarly, the JDBC API provides a means
to use SQL to access relational and other external JDBC DataSource objects.
However, only pureQuery allows an application to access all of these
sources of data, individually, or in combination, with a single, well-known
query language.
- Provides a simple, straightforward programming model for data
access
- pureQuery runs as a thin layer on top of JDBC and simplifies queries,
updates, calls to stored procedures, and other tasks that are associated
with accessing databases. It runs on Java 2
Platform, Standard Edition 5.0 (J2SE 5.0) and Java Platform, Standard Edition 6 (Java SE 6).
- Automatically maps SQL data to return types with little developer
intervention, but allows you to supply customized code for complex
mappings
- It provides automatic mapping between SQL query results and returned
objects for many Java object
patterns. For complex mappings between query results and Java objects, there is a pluggable exit interface
that allows for custom mappings.
- Supports developing SQL applications using annotated methods and
inline methods
- Supports annotated methods if you want to define
your own methods in custom interfaces. You create methods with definitions
that are annotated with SQL statements. You can develop applications
that follow the Data Access Object (DAO) pattern by creating data
access objects using annotated methods.
- Supports inline methods if you want to take advantage
of the methods that are defined in the IBM-supplied Data interface.
Inline methods are useful for applications that require the construction
of SQL statements during application runtime. With inline methods,
SQL statements are passed as parameters in method invocations, and
is similar to the approach that is taken in JDBC and SQLJ.
- Supports both dynamic and static SQL at run time
- Applications that you develop with the pureQuery API can use dynamic
SQL with a standard JDBC driver for both embedded SQL and ad hoc SQL
that is not known until run time.
- pureQuery API applications can also use static SQL when the code
uses the annotated-method programming style and DB2® databases. For more information about using
static SQL, see Running SQL statements statically.
- Supports JDBC Type 2 connections when you run pureQuery applications
on z/OS®
- Because the JDBC Type 2 driver is a combination of Java and native code, Type 2 connections are
generally better performing than Type 4 connections.