You can define data sources for a specific application for a remote
or local WebSphere® Application
Server v6.0.
Prerequisite
- Create an enterprise application and target the server to WebSphere Application
Server v6.0.
To test your data sources on a WebSphere Application Server v6.0,
complete the following steps:
- Switch to the J2EE perspective.
- In the Project Explorer view, expand the Enterprise
Applications folder.
- Under the enterprise application project folder for which you want
to test the data source, double-click the Deployment Descriptor to
open the Application Deployment Descriptor editor.
- Select the Deployment tab at the bottom
of the editor.
- Expand the Data Source section.
- A JDBC provider for Cloudscape™ will already be created
for you. In that case, you may skip the below step if the predefined
JDBC provider satisfies your requirements. Before using the predefined JDBC
provider, verify that the Class path field specified
in the Modify a JDBC Provider wizard is the correct class path that contains
the database driver. You can complete this by selecting the JDBC provider
from the JDBC provider list and click Edit to view
or edit the JDBC class path.
- Create a JDBC provider. A JDBC provider contains configuration
for software that enables Java™ applications to connect to JDBC-compliant
databases.
- Beside the JDBC provider list table, click Add. The Create a JDBC Provider wizard opens.
- In the Database type list box, select
a database type.
- In the JDBC provider type list box,
select a JDBC provider and click Next.
Table 1. Examples of different JDBC providersJDBC Driver Types |
Example of resource provider |
IBM® DB2® |
DB2 Legacy
CLI-based Type 2 JDBC Driver |
Oracle |
Oracle JDBC Driver |
Sybase |
Sybase JDBC Driver |
- In the Name field, type the name of
the resource provider.
- In the Implementation class name list,
select or type the Java class name of the JDBC provider implementation.
Table 2. Examples of different Java class
names of the JDBC provider implementationJDBC Provider Types |
Example of Java class name |
DB2 |
COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource |
Oracle |
oracle.jdbc.pool.OracleConnectionPoolDataSource |
Sybase |
com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource |
- In the Class path list box, if a driver
path does not appear, click the Add Path or the Add
External JARs button (you do not need to specify a class path
if you are using Cloudscape). Type or browse to the path where JAR files containing driver classes
are located. Ensure that the class path for the JDBC driver is specified correctly
for the installation of DB2 on the machine where you are running WebSphere Application
Server.
Table 3. Examples of different JAR files containing
driver classesJDBC Driver Types |
Example of JAR files containing driver classes |
DB2 |
c:/Program Files/IBM/SQLLIB/java/db2java.zip |
Oracle |
- C:\Oracle\Oracle9i\jdbc\lib\ojdbc14.zip
|
Sybase |
c:\jdbc\Sybase\classes\jconn2.jar |
Note: 
The
default DB2 JDBC
provider class path on Linux
® is set to
${DB2_JDBC_DRIVER_PATH}/db2java.zip.
The DB2 installation
location cannot be detected on Linux. You must manually remove this class
path entry and add a new entry with the correct path in the server editor
if you want to use a DB2 data source on Linux.
- In the Native path list box, specify
a list of paths that forms the location for the resource provider native libraries.
Native path entries are separated by using the ENTER key and must not contain
path separator characters (such as ';' or ':'). Native paths can contain variable
(symbolic) names which you can substitute using a variable map.
- Click Finish.
- Define a data source and resource properties. Beside Data
sources defined in the JDBC provider selected above list, click
Add.
- The Create a Data Source wizard opens.
- Select the type of JDBC provider, for example DB2 Legacy CLI-based
Type 2 JDBC Driver Provider.
- Specify a data source for WebSphere Application Server version
5.0 or version 4.0. Click Next.
Note: Due
to a limitation in the WebSphere Application Server, the Universal Test
Client can only view version data sources for WebSphere Application Server version
4.0. Although data sources for WebSphere Application Server version
5.0 are still visible in the JNDI Explorer, you will not be able to view their
details.
- On the Modify Data source page, specify the details of the data
source that you want to create. For more information about any
of the fields on this wizard, select the field and then press F1.
Click Next.
- On the Create Resource properties page, select the resource
property you want to modify, for example databasename.
- In the Value field, type the value for
this property, for example, sample for the database
name.
Table 4. Examples of different resource propertiesdatabaseName |
Value |
DB2 |
database_name |
Oracle |
database_name |
Cloudscape |
D:\temp\cloudscape\ database_name |
- Save and close the server editor. The data source entries
has been added to the deployment descriptor files.
Note: For Oracle, you must define the URL resource property with the
value jdbc:oracle:thin:@ server_name :1521: database_name.