ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzamy_5.4.0.1/50/program/datamod.htm

48 lines
4.2 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<LINK rel="stylesheet" type="text/css" href="../../../rzahg/ic.css">
<title>Data access development model</title>
</head>
<BODY>
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../../../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h5><a name="datamod"></a>Data access development model</h5>
<p>Follow these general steps to develop a data access application:</p>
<ol>
<li><p><strong>Decide how to implement data access.</strong>
<br>You can access data in various ways:</p>
<ul>
<li>By using standard or extended APIs</li>
<!-- <li>By using container-managed persistence beans</li>-->
<li><p>With Web components</p></li>
</ul>
</li>
<!--<p>The Enterprise JavaBeans (EJB) programming model provides several distinct server-side component types: entity, session, and message-driven beans, and servlets. Of these types, entity beans are typically used to model business components in an application. Entity beans have both state and behavior. </p>
<p>The state of entity beans is persistent and is stored in a database. As changes are made to an entity bean, its state is kept in synchronization with the database record representing the bean. There are two types of entity beans provided by the EJB model and these two types differ in the mechanism used to provide persistence. These two types of entity beans are container-managed persistence (CMP) beans and bean-managed persistence (BMP) beans. </p>
<p>With BMP beans, the developer manually produces code to manage the persistent state of the bean.</p>
<p>With CMP beans, the EJB container manages the beans persistent state. Persistent state management is a complex and difficult task and using CMP beans allows the developer to concentrate on business logic by delegating persistence behavior to the container. Typical examples of CMP beans are Customer, Account, and so on. Because CMP beans are objects, their data (state) is accessed using field accessors. For example, a Customer entity bean is likely to have fields such as name and phoneNumber. These pieces of data are accessed using the accessor methods getName()/setName() and getPhoneNumber()/setPhoneNumber(). As a developer, you are not concerned with how this data is eventually stored and retrieved from the back end database and can assume that the integrity of the data is maintained by the container. For more information, see <a href="datacmp.htm">Container-managed persistence features</a>.</p></li>-->
<li><p><strong>Create a JDBC provider and data source.</strong>
<br>An application component uses a connection factory to access a connection instance, which the component then uses to connect to the underlying enterprise information system (EIS). A data source is associated with a JDBC provider that supplies the specific JDBC driver implementation class. The data source represents the JCA connection factory for the relational resource adapter. For more information, see <a href="datacfg.htm">Configure WebSphere Application Server - Express to access databases</a> or <a href="dataj2cf.htm">Configuring Java 2 Connector connection factories</a>.</p></li>
<li><p><strong>Look up a data source or connection factory using a resource reference.</strong>
<br>Using a resource reference to access your data source or connection factory is required when running in WebSphere Application Server - Express. For more information, see <a href="datalkrr.htm">Looking up data sources with resource references for relational access</a>.</p></li>
<li><p><strong>Get a connection to a data source.</strong>
<br>The connection management architecture for both relational and procedural access to enterprise information systems (EIS) is based on the J2EE Connector Architecture (JCA) specification. The Connection Manager (CM), which pools and manages connections within an application server, is capable of managing connections obtained through both resource adapters (RAs) defined by the JCA specification, and DataSources defined by the JDBC 2.0 Extensions Specification.</p></li>
</ol>
</body>
</html>