Data access application programming interface support
Applications can access the backend data through the standard J2EE 1.3 defined application programming interfaces (APIs).
The standard APIs do not always provide a complete solution for an application that runs in an appserver. For example, the JDBC programming model sometimes does not completely work with the J2EE Connector Architecture (JCA) Specification (even though the JCA architecture has explicitly specified that it integrates with the JDBC programming model). These gaps cause some incompatibility between the JDBC and JCA programming models.
When getting and using shareable connections in a global transaction, it is not valid to change a property on the connection after you obtain it. Changes can unknowingly affect other users who share the same connection.
The J2EE Connector Architecture (JCA) Specification supports telling the resource adapter the specific properties settings at the time you request the connection (using the getConnection method) by passing in a ConnectionSpec. The ConnectionSpec contains the necessary connection properties used to get a connection. After you obtain a connection from this environment, your application does not need to alter the properties.
The JDBC programming model does not have the same interface to specify the connection properties. Instead, it gets the connection first, then sets the properties on the connection. In the case of a shareable connection, changing the connection properties impacts all the connections shared with the same physical connection.
WebSphere Application Server provides the following extensions to fill in the gaps between these two specifications.
- WSDataSource interface - this interface extends javax.sql.DataSource, and enables a component or an application to specify the connection properties through the WebSphere Application Server JDBCConnectionSpec to get a specific connection.
- getConnection(JDBCConnectionSpec) - this method returns a specific connection which has the JCA compliant connection behavior.
- For more information see the Javadoc wsdatasource in the Javadoc index.
- JDBCConnectionSpec interface - this interface extends the com.ibm.websphere.rsadapter.WSConnectionSpec, which extends javax.resources.cci.ConnectionSpec. The standard ConnectionSpec interface provides only the interface marker without any get and set methods. The WSConnectionSpec and JDBCConnectionSpec define a set of get and set methods used by the WebSphere Application Server run time. This interface enables the application to specify all the essential connection properties in order to get an appropriate connection. You can create this class from the WebSphere WSRRAFactory. For more information see the Javadoc JDBCConnection in the Javadoc index.
- WSRRAFactory - this is the Relational Resource Adapter Factory which allows the user to create a JDBCConnectionSpec or other resource adapter related object. For more information see the Javadoc wsrrafactory in the Javadoc index
Resource adapter
Example: Accessing data using IBM extended APIs for connections
Example: Accessing data using IBM extended APIs to share connections between container-managed and bean-managed persistence beans