Configuring WebSphere to handle the connection to a database is a multi-step process. First, you add a JDBC driver, such as a MySQL, MariaDB, Oracle, DB2, or SQL Server driver. Next, you create a data source to use the JDBC driver. Then, you configure the J2C alias (username, password).
In ths example, the MySQL JDBC driver is downloaded, from https://dev.mysql.com/downloads/connector/j/. This will download a tar archive. Move the tar archive onto your WebSphere server (Linux in this example). Decompress the gzip compress tar archive.
~]# gunzip mysql-<version>.tar.gz
Extract the tar archive.
~]# tar -xf mysql-<version>.tar
Copy the MySQL JAR into a directory where you will be storing your JDBC drivers (/opt/jdbc in this example).
~]# cp mysql-connector-java-version-bin.jar /opt/jdbc
Add the JDBC driver to WebSphere.
- In the left panel of the WebSphere web console, expand Resources > JMS.
- Select JDBC provider.
- Select New.
- At Step 1: Create new JDBC provider, select the appropriate database type. In this example, the implemenation classname should be com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource. Select the appropriate database type and select Next.
- At Step 2, enter the path to where the JAR is located on the WebSphere server and select Next.
- At step 3, select Finish. The JDBC provider should now be displayed. Next, create the data source.