+

Search Tips   |   Advanced Search

Configure data access for the Application Client

Configure data access for the Application Client 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 tools needed to configure data sources used by J2EE application clients:

Data access from an application client uses the JDBC driver connection functions directly from the client side. It does not take advantage of the additional pooling support available in the WAS run time. Configuring data access for an application client does not require configuration of a JDBC provider and data source on the WAS server machine.

To take advantage of the pooling and additional database functions provided by the product, IBM recommends that the client application utilize an enterprise bean running on the server side to perform data access.

Define

an application client resource reference using an assembly tool

  1. Assemble the application client module as described in the topic, Assemble Java EE client applications.

  2. Create a new resource reference:

    1. In a Project Explorer view, right-click the application client module and click Open With > Deployment Descriptor Editor.

    2. On the References tab, click Add > Resource reference > Next.

    3. On the Resource Reference page, enter the Name of this resource reference. The Application Client for WebSphere Application Server run time uses this name for two purposes: to bind the object into the java:comp/env portion of the JNDI namespace, and to find client specific configuration information. If the code for the Application Client performs a lookup for java:comp/env/jdbc/myDB, the name of the resource reference should be jdbc/myDB.

    4. For Type, select javax.sql.DataSource for JDBC connections.

    5. For Authentication, select Application if your client application intends to provide authentication information. If the Application Client run time provides the authentication information (as configured by the Application Client Resource Configuration tool), select Container.

    6. Ignore the Share scope setting; it is unused in an application client resource reference. All Application Client resources are not shared.

    7. Click Finish.

    8. Close the deployment descriptor and save the changes.


Results

The JNDI name field appears under WebSphere Bindings after your add the reference.


Client configuration with the ACRCT

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.

Restriction: The following objects, which can be bound into the server name space, are not supported on the client:

The Application Client does not provide client database drivers. If the client application uses a database directly, rather than using an enterprise bean, provide the database drivers on the client machine. This action can involve contacting the database vendor to acquire client database driver code and licenses.

Instead of accessing the database directly, IBM recommends that the 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 application server. Enterprise beans can also take advantage of the additional database functions provided by the run time.

  1. Configure a new data source provider as described in the topic Configuring new data source providers. This provider describes the JDBC database implementation for the client application.

  2. Enter the following information on the General tab:

    1. A name for this data source provider.

    2. Optional: A description.

    3. 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 class path configuration of the client.

    4. 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 the 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 class name 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 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 the database product documentation for valid properties on the data source implementation.

  3. Click OK.

  4. Configure a new data source as described in the topic, Configuring new data sources for application clients. This describes the client properties of the database the client application uses.

  5. Enter the following information on the General tab:

    1. 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 the client application program.

    2. Optional: A description.

    3. The JNDI name. This field is required and must match the value entered in the Name field on the Add Resource Reference page of the assembly tool. In the previous example, set this value to jdbc/myDB.

    4. Optional: The Database Name.

    5. Optional: Your userid in the User field.

    6. Optional: Your password in the Password field. This password does not display.

    7. Your password again to confirm in the Re-Enter password field. Note: The User and Password fields are used only when the Authentication field on the Add Resource Reference page of the assembly tool is set to Container.


Related concepts

  • Data sources


    Related tasks

  • Assembling Java EE client applications
  • Deploy a Java EE client application
  • Configure new data sources for application clients

  • Java EE client application class loading