Data access beans
Data access beans provide a rich set of features and function, while hiding much of the complexity associated with accessing relational databases.
They are Java classes written to the Enterprise JavaBeans specification.
You can use the data access beans in JavaBeans-compliant tools, such as the IBM Rational Application Developer. Because the data access beans are also Java classes, you can use them like ordinary classes.
The data access beans (in the package com.ibm.db) offer the following capabilities:
- Feature
Details
- Caching query results
- You can retrieve SQL query results all at once and place them in a cache. Programs using the result set can move forward and backward through the cache or jump directly to any result row in the cache.
For large result sets, the data access beans provide ways to retrieve and manage packets, subsets of the complete result set.
- Updating through result cache
- Programs can use standard Java statements (rather than SQL statements) to change, add, or delete rows in the result cache. You can propagate changes to the cache in the underlying relational table.
- Querying parameter support
- The base SQL query is defined as a Java String, with parameters replacing some of the actual values. When the query runs, the data access beans provide a way to replace the parameters with values made available at run time. Default mappings for common data types are provided, but you can specify whatever your Java program and database require.
- Supporting metadata
- A StatementMetaData object contains the base SQL query. Information about the query (metadata) enables the object to pass parameters into the query as Java data types.
Metadata in the object maps Java data types to SQL data types (as well as the reverse). When the query runs, the Java-datatyped parameters are automatically converted to SQL data types as specified in the metadata mapping.
When results return, the metadata object automatically converts SQL data types back into the Java data types specified in the metadata mapping.
Related Reference
Data access bean types
Data access: Resources for learning