WebSphere

How to connect to databases

You can connect to numerous databases, and in a variety of ways. This section shows some of the options.

Introduction

You might have databases that you want to use as service providers. Alternatively, you might want to use a database to trigger a service request, or use a database to add details to a service request, before the request is sent to the service provider.

You can use adapters to access databases as service endpoints, and you can use mediation modules to update service requests with information from databases.

The WebSphere Adapter for JDBC

Generally, if you want to use a database as a service requester, or a service provider, you use an adapter.

The WebSphere® Adapter for JDBC is a JCA adapter that can be used with any database that has a JDBC driver supporting the JDBC 2.0 specification, or a later specification. For example: DB2®, Oracle, Microsoft® SQL Server, Sybase, and Informix®. The JDBC adapter supports inbound and outbound processing. For more information on the WebSphere Adapter for JDBC, see Click this link to go to the topic for WebSphere Integration Developer..

EIS imports and exports let you connect from WebSphere ESB, or WebSphere Process Server, to resource adapters such as the WebSphere Adapter for JDBC. With an EIS import, a service requester can access a database or call a program on an enterprise information system (EIS) system. With an EIS export, an EIS application can call a service provider on another system.

Connect using a JCA adapter: databases as service providers

You can connect to any database that has a JDBC driver supporting the JDBC 2.0 specification, using the WebSphere Adapter for JDBC. WebSphere ESB and WebSphere Process Server can convert data between the business objects that the JDBC adapter outputs, and the interface that the service requester expects.

This solution gives you flexibility and scalability: the JDBC adapter can be replaced with a different type of adapter or binding if the service provider changes.
Figure 1. Using a WebSphere JDBC adapter
A service requester can communicate with the ESB through an export; the ESB can communicate with a JDBC adapter, which communicates with a database.

Connect using a JCA adapter: triggering service requests from database events

You can set up database trigger events and use them to trigger Web services:
  1. Events are triggered by records being written to a database table.
  2. The JDBC adapter gets the event output and creates business objects. Business objects are containers for application data that represents business elements, such as a database table or the result of an SQL query. The adapter understands the data format provided by the application, and can process the data, perform the operation, and send the results back in that format.
  3. WebSphere ESB, or WebSphere Process Server, can convert the business objects to a format that the Web services interface expects.
Figure 2. Using a JDBC adapter
A JDBC trigger event can cause event output to be sent to a JDBC adapter, which then communicates with the ESB through an EIS export.

Connect using a mediation module: updating service requests using databases

You can access databases while service requests are flowing through WebSphere ESB or WebSphere Process Server.

For example, you might want to update messages with data from a database, or log part of a message to a database. To do this you can use the mediation primitives that are the building blocks of mediation modules.
  • The Database Lookup mediation primitive lets you look up information in a database table, and store the information in the message being processed.
  • The Message Logger mediation primitive lets you log a message to a database. The schema used for the table that the message is logged to, is fixed. Typically, database create or update operations that need more flexibility would use a JDBC adapter.
  • The Service Invoke mediation primitive lets you call a service endpoint. The service endpoint can be an EIS system, if you use a reference and an EIS import. You can create an EIS import using the WebSphere Integration Developer external service wizard, and a resource adapter such as the WebSphere Adapter for JDBC.

For more information on the mediation primitives, see: Click this link to go to the topic for WebSphere Integration Developer..

Figure 3. Using mediation primitives inside a mediation module
As messages pass through mediation flows, they can be updated with information from databases.

concept Concept topic

Terms of use | Feedback


Timestamp icon Last updated: 20 June 2010 00:38:43 BST (DRAFT)


http://publib.boulder.ibm.com/infocenter/dmndhelp/v6r2mx/topic//com.ibm.websphere.wbpm.scenarios.esb1.620.doc/concepts/cwesb_scenario_dbs.html
Copyright IBM Corporation 2005, 2010. All Rights Reserved.
This information center is powered by Eclipse technology (http://www.eclipse.org).
iDoc on