These are the steps to configure MySQL Data Source in IBM WebSphere:
1. Create JAAS (J2C authentication data) Credential
2. Create MySQL JDBC Provider
3. Create MySQL Data Source
Let’s start to proceed with the detailed steps:
1. Create JAAS Credential
Go to this screen:
Security > Global Security > Authentication > J2C authentication data
Create new authentication data by filling up the username and password. You can give this authentication data a name to use later when connecting data source to database.
2. Create MySQL JDBC Provider
Go to this screen:
Resources > JDBC > JDBC providers
Select the in which scope you want to configure this JDBC Provider, and click New...
.
Database type: User-defined
Implementation class name: com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Name: MySQL JDBC Provider
Class path: D:\Java\mysql-connector-java-5.1.33\mysql-connector-java-5.1.33-bin.jar
Check "Isolate this resource provider"
Save the configuration to master configuration.
3. Create MySQL Data Source
Resources > JDBC > Data sources
Select the in which scope you want to configure this Data source, and click New...
.
Data source name: MySQL Data Source
JNDI Name: jdbc/MySQLDataSource
Select an existing JDBC Provider: MySQL JDBC Provider
Data store helper class name: com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper
Keep "Use this data source in container managed persistence (CMP)" checked
Component-managed authentication alias: [Select authentication data name created through step No. 1]
Mapping-configuration alias: (none)
Container-managed authentication alias: [Select authentication data name created through step No. 1]
Save the configuration to master configuration.
Click on the data source name. In Additional Properties
click Custom properties
.
Search for these entries and set the string value by clicking on each entries, and fill the value in the Value
field.
serverName: localhost
portNumber: 3306
databaseName: [database name]
Verifying Data Source
You can back to Resources > JDBC > Data sources
to test the configuration by selecting the data source and click on the Test connection
button.