Why and when to perform this task
Configuring data access for application clients involves specifying
the resource reference and associated database information required for data
access. This specification is done as part of the assembly and deployment
steps for the application client.
There are two essential tools needed
to configure data sources used by J2EE Application Clients: the Application
Assembly Tool (AAT) for defining the resource reference in the deployment
descriptor, and the Application Client Resource Configuration Tool (ACRCT)
for defining the connection to the database in the client deployment environment.
Data
access from an application client uses the JDBC drive connection functions
directly from the client side. It does not take advantage of the additional
pooling support available in the WebSphere Application Server run time. Configuring
data access for an application client does not require configuration of a
JDBC provider and data source on the WebSphere Application Server server machine.
If
you want to take advantage of the pooling and additional database functions
provided by WebSphere Application Server, it is recommended that your client
application utilize an enterprise bean running on the server side to perform
data access.
Defining an application client resource reference in
the Application Assembly Tool
Client configuration with the ACRCT
Why and when to perform this task
There are two client resources for you to configure in the Application
Client Resource Configuration Tool (ACRCT) to enable data access from an application
client: a data source provider and a data source.
Notes: The
following WebSphere objects, which can be bound into the server namespace,
are not supported on the client:
- Java 2 Connector (J2C) objects
- Connection manager objects
The WebSphere Application Server Client does not provide client database
drivers. If your client application uses a database directly, rather than
using an enterprise bean, you must provide the database drivers on the client
machine. This action can involve contacting your database vendor to acquire
client database driver code and licenses.
Instead of accessing the
database directly, it is recommended that your client application use an enterprise
bean. Accessing a database through an enterprise bean eliminates the need
to have database drivers on the client machine because the database access
is handled by the enterprise bean running on the WebSphere Application Server.
Enterprise beans can also take advantage of the additional database functions
provided by the WebSphere Application Server run time.
Steps for this task
- Configure a new data source provider as described in Configuring
new data source providers.
This provider describes the
JDBC database implementation for your client application.
- Enter the following information on the General Tab:
- A name for this data source provider.
- A description (this is optional).
- The classpath to the data source provider implementation
classes or JAR files. This is optional if the implementation classes or JAR
files are already in the classpath configuration of the client.
- The name of the implementation class. For example, for
DB2 this value is COM.ibm.db2.jdbc.DB2DataSource. Remember this class
must implement the javax.sql.DataSource class. The ACRCT does not
verify this class and you receive an error when you run your client application
if the class does not implement javax.sql.DataSource.
Use the Custom Tab to configure non-standard properties of the
data source provider. This panel enables you to enter property-value pairs.
During run time the implementation classname is created and any custom
properties added on this panel are set on the newly created data source object
using reflection. Any properties configured on this panel must have an appropriate
set method on the data source class. For example, assume there is a property
called use2Phase and its value should be 1. On the custom panel you
enter the value use2Phase into the name column and the value 1 into
the value column. The WebSphere Application Client run time then uses
reflection to find a property on the data source class called, typically setUse2Phase and
call that method passing the value of 1. See your database product documentation
for valid properties on your data source implementation.
- Click OK.
- Configure a new data source as described in Configuring
new data sources for application clients.
This describes
the client properties of the database your client application uses.
- Enter the following information on the General Tab:
- A Name. This field is required and identifies a name
for the Application Client Resource Configuration Tool to use. This name
is not used by your client application program.
- A description (this field is optional).
- The JNDI name. This field is required and must match
the value entered in the Name field of the General Tab of the Application
Assembly Tool. In the example above, set this value to jdbc/myDB.
- The Database Name (this field is optional).
- Your userid in the User field. This field is
optional.
- Your password in the Password field. This password
does not display. This field is optional.
- Your password again to confirm in the Re-Enter password field.
Note: The User and password fields are only used when the Authentication
field on the General tab of the Application Assembly Tool is set to Container.