Before creating a data source, you will need to add a JDBC driver to WebSphere for the database that you want to connect to, such as MySQL, MariaDB, Oracle, DB2, or SQL Server.
Create the data source.
- In the left panel of the WebSphere web console, expand Resources > JDBC, and select Data sources.
- In the scope drop-down selector, select the scope (node and server or cluster) that the data source will reside on.
- Select New.
- At Step 1, give the data source a unique name and a unique JNDI name. Ensure your JNDI name begins with jdbc/. Select Next.
- If prompted to select a JDBC provider, select the JDBC provider for the database you are connecting to and select Next.
- When prompted to enter database specific properties for the data source, just select Next.
- When prompted to setup the security aliases, keep all selections at none, and select Next. The security aliases will be configured after the J2C alias (username, password) are configured.
- Select Finish. The new data source should now be listed.
Configure the database name, port, and hostname.
- Select your data source.
- Select Custom properties.
- Select databaseName, enter your database name, and select OK.
- Select port, enter your database port, and select OK.
- Select serverName, enter your database server name, and select OK.
- Select Save.
Next, create the J2C alias.