WAS v8.5 > Administer applications and their environment > Welcome to administering Data access resources > Administer data access applications > Configure a JDBC provider and data source

Configure a data source

Application components use a data source to access connection instances to a relational database.

The application server supports two different versions of data source. Determine the data source for the environment according to the enterprise bean and servlet specification levels that are the basis of the applications:

When creating a data source, you associate it with a JDBC provider that is configured for access to a specific vendor database. The application server requires both objects for the applications to make calls to that particular database and receive data from it. The data source provides connection management capabilities that physically make possible these exchanges between the applications and the database.

  1. Open the dmgr console.

  2. Access the necessary console panel. Use one of the following paths:

    • Resources > JDBC > Data sources
    • Resources > JDBC > Data sources (WAS Version 4)
    • Resources > JDBC > JDBC providers > JDBC_provider > Data sources
    • Resources > JDBC > JDBC providers > JDBC_provider > Data sources (WAS Version Version 4)

  3. Select the scope at which applications can use the data source. Choose a cell, node, cluster, or server. For more information, see the topic on scope settings.

    Version 4 only: From this point onward, the steps for creating WAS Version 4 data sources differ from the steps for creating data sources of the latest standard version. To configure a Version 4 data source:

    • Click New to proceed to the console panel for defining required properties.

    • On this properties panel specify values for the fields that are grouped under the heading Configuration. The application server requires these properties to implement your JDBC driver classes.

      li> Save your configuration by clicking OK. You are now finished with the primary data source configuration tasks.

      li> Define other properties the database vendor might require, or offer as options, for using the JDBC driver. The application server calls them custom properties, and requires set them on the data source. Begin by clicking the Custom Properties link that is now displayed on the dmgr console panel. Consult the database documentation to learn about these required and optional properties.

  4. Click New. This action causes the Create a data source wizard to launch and display the Enter basic data source information panel. The first field is the scope field, which is read-only. This field displays your previous scope selection.

    li> Type a data source name in the Data source name field. This name identifies the data source for administrative purposes only.

    li> Type a JNDI name in the JNDI name field. The application server uses the JNDI name to bind resource references for an application to this data source. Follow these requirements when we specify JNDI names:

    • Do not assign duplicate JNDI names across different resource types, such as data sources versus J2C connection factories or JMS connection factories.
    • Do not assign duplicate JNDI names for multiple resources of the same type in the same scope.

    For more information on JNDI, consult the topic on naming.

  5. Click Next to see the Select JDBC provider panel. The Select JDBC provider panel is skipped if we do not have any JDBC providers configured at the current scope.

  6. Select an existing JDBC provider, or create a new provider.

    • Select an existing JDBC provider.

      1. Click Select an existing JDBC provider.

      2. Select a JDBC driver from the list.

      3. Click Next. You now see the panel entitled Enter database specific properties for the data source.

    • Create a new JDBC provider.

      1. Click Create new JDBC provider.

      2. Click Next to see the Create JDBC provider panel.

      3. Use the first drop-down list to select the database type of the JDBC provider that create.

        The User-Defined option: Select User-Defined for the database type if you encounter either of the following scenarios:

        • We do not see the database type.
        • We cannot select the JDBC provider type that you need in the next step.

        The user-defined selection triggers the wizard panel to display your provider type as a User-defined JDBC provider, and your implementation type as User-defined. Consult the database documentation for the JDBC driver class files, data source properties, and so on required for the user-defined provider. Supply this information on the next two wizard panels:

        • database class path information
        • database-specific properties

      4. If the JDBC provider type is displayed in the second list, select your JDBC provider type. Select Show Deprecated to trigger the display of both current and deprecated providers. If we cannot find your provider in this expanded list, then select User-Defined from the previous list of database types.

      5. From the third list, select the implementation type that is necessary for the application. If the application does not require that connections support two-phase commit transactions, choose Connection Pool Data Source. Choose XA Data Source, however, if the application requires connections that support two-phase commit transactions. Applications that use this data source configuration have the benefit of container-managed transaction recovery.

        After you select an implementation type, the wizard fills the name and the description fields for the JDBC provider. We can type different values for these fields; they exist for administrative purposes only.

      6. Click Next after we have defined the database type, provider type, and implementation type. Now you see the wizard panel Enter database class path information.

      7. In the class path field, type the full path location of the database JDBC driver class files. Your class path information becomes the value of the WebSphere environment variable that is displayed on this panel, in the form of ${DATABASE_JDBC_DRIVER_PATH}. The application server uses the variable to define your JDBC provider; this practice eliminates the need to specify static JDBC class paths for individual applications. Remember that if we do not provide the full, correct JDBC driver class path for the variable, your data source ultimately fails. If the field already displays a fully qualified class path, we can accept that variable definition by completing the rest of this wizard panel and clicking Next.

      8. Use the Native library path field to specify additional class files that your JDBC driver might require to function properly on the application server platform. Type the full directory path name of these class files.

      9. Click Next. You now see the Enter database specific properties for the data source panel.

  7. Complete all of the fields on the Enter database specific properties for the data source panel.

    • Click Use this data source in container managed persistence (CMP) if container managed persistence (CMP) enterprise beans must access this data source.

    • Any other property fields that are displayed on this wizard panel are specific to the database type. See the topic, Data source minimum required settings, by vendor, for information on these property settings. The article addresses both current and deprecated JDBC providers that are predefined in the application server.

      User-defined data sources: This wizard panel does not display additional property fields for data sources that correspond with the user-defined JDBC providers. However, from the JDBC driver class files that you installed, the application server can generally extract the necessary data source property names. The application server defines them as data source custom properties, displays them on a custom properties console panel, and assigns them default values. Consult the database documentation about setting these properties and any other requirements for the user-defined data source. After creating the data source, navigate to the corresponding custom properties collection panel in the dmgr console by clicking Data sources > data_source > Custom properties. Review the property default values and modify them if necessary.

  8. Optional: Configure the security aliases for the data source. We can select none for any of the authentication methods, or choose one of the following types:

    • Component-managed authentication alias - specifies an authentication alias to use when the component resource reference res-auth value is Application. To define a new alias, navigate to Related Items > J2EE Connector Architecture (J2C) authentication data entries. A component-managed alias represents a combination of ID and password specified in an application for data source authentication. Therefore, the alias set on the data source must be identical to the alias in the application code.

      1. Use the drop-down list to select an existing component-managed authentication alias.

      2. To create a new alias, click the links provided. This action closes the data source wizard and triggers the dmgr console to display the J2C authentication data panel. Click New to define a new alias. Click OK to save your settings and view the new alias on the J2C authentication data panel. Restart the data source wizard by navigating back to the data source collection panel, selecting the appropriate scope, and clicking New.

      For more information on Java 2 Connector (J2C) security, see the topic on managing Java 2 Connector Architecture authentication data entries.

    • Mapping-configuration alias - is used only in the absence of a login configuration on the component resource reference. The specification of a login configuration and the associated properties on the component resource reference is the preferred way to define the authentication strategy when the res-auth value is set to Container. If we specify the DefaultPrincipalMapping login configuration, the associated property is a JAAS - J2C authentication data entry alias.

    • Container-managed authentication alias - is used only in the absence of a login configuration on the component resource reference. The specification of a login configuration and the associated properties on the component resource reference determines the container-managed authentication strategy when the res-auth value is set to Container.

    If we have defined security domains in the application server, we can click Browse... to select an authentication alias for the resource that you are configuring. Security domains support isolating authentication aliases between servers. The tree view is useful in determining the security domain to which an alias belongs, and the tree view can help you determine the servers that are able to access each authentication alias. The tree view is tailored for each resource, so domains and aliases are hidden when we cannot use them.

  9. Click Next to view the Summary panel, and review any information for the data source. If any information is not correct, we can click Previous to go back and correct it.

  10. Click Finish to save the configuration and exit the wizard. You now see the Data sources panel, which displays your new configuration in a table along with other data sources configured for the same scope.

The following topics in this information center inform you of how to use the dmgr console to assign the property values:


Subtopics


Related concepts:

Data source lookups for enterprise beans and web modules
Data sources
JDBC providers
Naming


Related


Manage Java 2 Connector Architecture authentication data entries for JAAS


Reference:

WAS data source properties
Data source minimum required settings, by vendor
Data source settings
Data source (WAS Version 4) settings
Connection pool properties


+

Search Tips   |   Advanced Search