Create JDBC data source
Data sources are associated with a specific JDBC provider and can be viewed or created from the JDBC provider configuration page. You have two options when creating a data source, depending on the J2EE support of the application. This section discusses creating or modifying data sources for J2EE 1.3 and J2EE 1.4 applications.
To create a data source...
- Expand...
Resources | JDBC | Data sources
- Select the scope. Although you can select All to view all resources, select a specific scope to create a resource.
- Click New to create a new data source. This will start a wizard.
Data source name Name by which to administer the data source. Use a name that is suggestive of the database name or function. JNDI name Data source's name as registered in the appserver's name space. When installing an application that contains modules with JDBC resource references, the resources defined by the deployment descriptor of the module need to be bound to the JNDI name of the resources. For example, jdbc/<database_name>. Component-managed authentication alias
Authentication alias for XA recoveryUser ID and password to be used by J2C security. Component-managed authentication alias references J2C authentication data entries. Make new entries by selecting the J2C authentication data entries link on the data source configuration window.
Authentication alias for XA recovery is used to specify the authentication alias that should be used during XA recovery processing.
Click Next.
- Now specify database specific properties. Click Next.
Select a JDBC provider or to create a new one. If you create a new JDBC provider, you will be routed through the windows seen earlier. If you select an existing JDBC provider you will continue with the next step here.
In this case, we select an existing JDBC provider and click Next.
The entries shown in Figure 6-10 are specific to the JDBC driver and data source type. Figure 6-10 shows the properties for the DB2 Universal data source.
Database Name Name of the database (or the cataloged alias). Driver type Type of JDBC Driver (2 or 4) used to access the database. DB2 server name and port. Default 50000 Container-managed persistence Specifies if the data source is to be used for container-managed persistence of EJB beans. Checking this box causes a CMP connection factory corresponding to this data source to be created for the relational resource adapter. The connector factory created has the name...
<datasourcename>_CF
...and is registered in JNDI under the entry...
eis/<jndi_name>_CMP
You can see the properties of the just created connection factory by selecting...
Resources | Resource Adapters | Resource Adapters
Enable the Show built-in resources check box (new in V6.1) in the preferences. Select...
WebSphere Relational Resource Adapter | CMP Connection Factories
Be sure to set the scope so it is the same as that for the data source.
Click Next.
- You will see a summary of the options you have chosen. Click Next to create the data source.
The new data source will be listed in the table of resources. You can test the new connection by checking the box to the left of the data source and clicking Test Connection.
You can view or modify settings for the new data source by clicking the name in the resources list. Figure 6-11 shows a portion of the details page. Other settings not shown include the database details and the component-managed authentication settings.