This guide is a quick overview of how to use MySQL with WAS. Before we begin, we first download the MySQL JDBC connector http://dev.mysql.com/downloads/connector/j/
Create the JDBC Provider definition for MySQL
Log in to the WebSphere 8 Administrative Console select JDBC providers from the JDBC group in the Resources section.
Choose you scope and then click New
As seen in the actual JAR you can use this path inside the expanded JAR file (use 7zip to explore JAR). mysql-connector-java-5.1.18-bin.jar\com\mysql\jdbc\jdbc2\optional\
This allows me to deduce that we can Enter com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource in the Implementation class name field.
Click Next to define the location of the JAR file
I have downloaded to [/var/apps/mysql_jdbc/mysql-connector-java-5.1.18/ mysql-connector-java-5.1.18-bin.jar]
Click Finish and Save.
Create a JDBCdatasource
Using the MySQl provider we added we are gong to crate and test a data source
Select Data sources, then choose your scope ie Cell scope and click New
Type in an appropriate JNDI name and actual data source name. I used MYSQL_DataSource as my name and jdbc/mysql_datasource as my jndi name.
On the select JDBC provider page, choose the MYSQL Provider we created above.
Use the defaults… Click Next again
Click Next to continue, then review summary and click Finish and Save. Now we need to crate a J2C authentication alias. In the Data sources list screen, click the new Data source.
Locate the Related item section and click on JAAS – J2C Authentication data
Add an Alias, Usr Id and password
Click Apply and on the Data sources list page we can test using the Test Connection button.
Result of successful test in SystemOut.log and message on screen
[2/2/12 22:46:25:999 GMT] 0000014c DSConfigHelpe W DSRA0174W: Warning: GenericDataStoreHelper is being used.
[2/2/12 22:46:26:009 GMT] 0000014c DSConfigurati I DSRA8203I: Database product name : MySQL
[2/2/12 22:46:26:010 GMT] 0000014c DSConfigurati I DSRA8204I: Database product version : 5.0.77
[2/2/12 22:46:26:011 GMT] 0000014c DSConfigurati I DSRA8205I: JDBC driver name : MySQL-AB JDBC Driver
[2/2/12 22:46:26:012 GMT] 0000014c DSConfigurati I DSRA8206I: JDBC driver version : mysql-connector-java-5.1.18 ( Revision: firstname.lastname@example.org )
[2/2/12 22:46:26:012 GMT] 0000014c DSConfigurati I DSRA8030I: Successfully connected to DataSource, with 1 warnings.
What we need to do now is add additional JDBC Data source options. We need to specify some additional properties for WAS to connect to the MySQL database. This document contains the additional information on how to set Custom Properties required to configure a MySQL data source. Use this document in conjunction with my Original MySQL document. Navigate to the Data Sources view by clicking on Resources | JDBC | JDBC Providers
Click to open the settings page for the appropriate Data source Select you appropriate Data Source an click to open. Locate the Additional properties section and click on Custom properties link
We need to add three properties to ensure our MySQL data source is used correctly. Values for the three custom properties you need to ensure WAS knows how to connect to MySQL.
||<you database name>
You need to do this for all Data Sources to ensure each Data Source has the correct Database specified.