Configure MySQL in WebSphere
__________________________________________
I.
Create JAAS – J2C authentication.
1.
Global security > JAAS - J2C authentication
data > New
Alias : Plantsdb_User
User ID : root
Password : password
Description :
II.
Create JDBC Provider.
1.
Resources > JDBC
providers > Select the scope of this resource to be
created.
2.
Click New.
Database type : User defined
Implementation class name : com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource
Name : MySql JDBC Provider
Description : Mysql JDBC provider custom configuration
3.
Click Next
4.
Class path :
/opt/sqldrivers/mysql-connector-java-5.0.8-bin.jar
5.
Finish
>
Save configuration.
III.
Create a data source
1.
Resources
> Data sources >
Select the scope of this resource to be created.
2.
Click New.
Data source name : PLANTSDB
JNDI name : jdbc/PlantsByWebsphereDS
3.
Select JDBC provider
Create new JDBC provider : <create new jdbc provider if
you haven’t created any>
Select an existing JDBC provider : MySql JDBC Provider
4.
Enter database specific properties for the data
source.
Data store helper class name : com.ibm.websphere.rsadapter.ConnectJDBCDataStoreHelper
Use this data source in container managed persistence (CMP) : Select this
option.
5.
Setup security aliases
Component-managed authentication alias : Plantsdb_User
Mapping-configuration alias : None
Container-managed authentication alias : Plantsdb_User
6.
Finish
>
Save configuration.
IV.
Create Custom properties for the Data source.
1.
Data sources > PLANTSDB
> Custom properties
2.
Click New.
Name : port
Value : 3306
3.
Click Apply
> Save
4.
Click New.
Name : databaseName
Value : APP
5.
Click Apply > Save
6.
Click New.
Name : user
Value : root
7.
Click Apply > Save
8.
Click New.
Name : password
Value : <password>
9.
Click Apply
> Save
10.
Click New.
Name : serverName
Value : <hostname or ipaddress>
11.
Click Apply
> Save
V.
Restart the server and Test the connection.
Troubleshooting
1.
Ensure that MySQL server is started properly and
listening on the given port.
2.
You need to download mysql driver and ensure
that the proper class is there in the jar.
3.
Ensure that the jndi name, username and password provided are correct.
Thanks for your article. It is well-designed and simple and is way better than anything on the Oracle or IBM sites. It really helped me.
ReplyDelete