Create and configure data sources

Setting up a server to test data sources for WebSphere Application Server v6.0

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:

  1. Switch to the J2EE perspective.

  2. In the Project Explorer view, expand the Enterprise Applications folder.

  3. 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.

  4. Select the Deployment tab at the bottom of the editor.

  5. Expand the Data Sources section.

    Data Sources

  6. 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.

  7. Create a JDBC provider. A JDBC provider contains configuration for software that enables Java applications to connect to JDBC-compliant databases.

    1. Beside the JDBC provider list table, click Add. The Create a JDBC Provider wizard opens.

    2. In the Database type list box, select a database type.

    3. In the JDBC provider type list box, select a JDBC provider and click Next.

      Examples of different JDBC providers:

      • IBM DB2 - DB2 Legacy CLI-based Type 2 JDBC Driver

      • Oracle - Oracle JDBC Driver

      • Sybase - Sybase JDBC Driver

      DB2 Legacy CLI-based Type 2 JDBC Driver

    4. In the Name field, type the name of the resource provider:

      Name of the resource provider

    5. In the Implementation class name list, select or type the Java class name of the JDBC provider implementation.

      Examples of different Java class names of the JDBC provider implementation:

      • DB2 -

      • Oracle - oracle.jdbc.pool.OracleConnectionPoolDataSource

      • Sybase - com.sybase.jdbc2.jdbc.SybConnectionPoolDataSource

    6. 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.

      Examples of different JAR files containing driver classes:

      • DB2 - C:/Program Files/IBM/SQLLIB/java/

      • Oracle - C:\Oracle\Oracle9i\jdbc\lib\

      • Sybase - C:\jdbc\Sybase\classes\jconn2.jar

      Note: The default DB2 JDBC provider class path on Linux is set to ${DB2_JDBC_DRIVER_PATH}/ 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.

    7. 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.

    8. Click Finish.

  8. Define a data source and resource properties. Beside Data sources defined in the JDBC provider selected above list, click Add.

    Data sources defined in the JDBC provider selected above

  9. The Create a Data Source wizard opens.

    1. Select the type of JDBC provider, for example DB2 Legacy CLI-based Type 2 JDBC Driver.

      DB2 Legacy CLI-based Type 2 JDBC Driver

    2. 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.

    3. On the Modify Data Source page, specify the details of the data source that you want to create.

      NOTE: Only one copy of a unique JNDI Name is permitted on any particular server, to make it possible to uniquely look up these data sources on the naming service for this server instance.

      Click Next.

      Modify Data Source

    4. On the Create Resource Properties page, select the resource property you want to modify, for example databaseName.

      Create Resource Properties

    5. In the Value field, type the value for this property, for example, BANKDB for the database name.

      Examples of different resource properties:

      • DB2: databaseName - database_name

      • Oracle: databaseName - database_name

      • Cloudscape: databaseName - D:\temp\cloudscape\database_name

  10. Save and close the server editor. The data source entries has been added to the deployment descriptor files.

    New data source

Note: For Oracle, you must define the URL resource property with the value jdbc:oracle:thin:@server_name:1521:database_name.

Professional hosting     Belorussian informational portal         Free SCBCD 1.3 Study Guide     Free SCDJWS 1.4 Study Guide     SCDJWS 1.4 Quiz     Free IBM Certified Associate Developer Study Guide     Free SCJP 5.0 (Tiger) Study Guide     Free Mock Exam Engine     Free SCWCD 1.4 Study Guide     IBM Test 000-287. Enterprise Application Development with IBM WebSphere Studio, V5.0 Study Guide