Accessing a data source from a WebSphere Application Server V5 J2EE application client
 Technote (FAQ)
 
Problem
There are several considerations when accessing a WebSphere® Application Server data source from a J2EE™ application client. The J2EE application client does not support direct access of data sources defined on the application server because the J2EE application client does not support Java™ 2 Connection Factories. However, the data source can be defined on the client side, using the Application Client Resource Configuration Tool (ACRCT). This technote explains the steps you must take to define and use a client-side data source.
 
Solution
  1. Run clientConfig.bat (Windows®) or clientConfig.sh (UNIX®) from the Install_Root /bin directory to start the ACRCT. When the ACRCT starts, you are prompted to specify the EAR file that contains the application client.

    You can then create client-side data sources, mail providers, JMS providers, URL providers, and resource environment providers.

  2. To begin, right-click Data Source Providers, then select New. The Data Source Provider Properties window is displayed as follows:




  3. The JDBC™ driver JAR or ZIP files must exist on the client machine. These files must be specified on the Classpath of the Data Source Provider. Also, the Implementation class must implement javax.sql.DataSource (not javax.sql.ConnectionPoolDataSource).

    For example, instead of specifying com.ibm.db2.jcc.DB2ConnectionPoolDataSource for the DB2 Universal JDBC Driver, specify com.ibm.db2.jcc.DB2DataSource. If the Implementation class does not implement javax.sql.DataSource, a NullPointerException is issued when getConnection() is called on the data source in the application client.


  4. After creating the data source provider, create the data source. Expand the newly created Data Source Provider, right-click Data Sources, then select New.

    The Data Source Properties window is displayed as follows:




  5. Provide values for the fields on the General tab. Also specify any required Custom Properties for the data source on the Custom tab.

  6. After creating the data source, save the changes and close the ACRCT.

Before the J2EE application client can access the new client-side data source, a resource reference to the data source must be configured. The Application Assembly Tool (AAT), Application Server Toolkit (ASTK) or WebSphere Studio Application Developer (WSAD) can be used to configure the resource reference.

After the resource reference is configured, the J2EE application client can access the new client-side data source by doing an indirect JNDI lookup, through the java:comp/env context, of the data source. It is not possible to do a direct JNDI lookup (without going through a resource reference) of a client-side data source.

 
 
Cross Reference information
Segment Product Component Platform Version Edition
Application Servers Runtimes for Java Technology Java SDK
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Application Client
Operating system(s): Windows
Software version: 5.1.1.4
Software edition:
Reference #: 1189605
IBM Group: Software Group
Modified date: May 13, 2005