FreeKB - Create a data source in WebSphere
Create a data source in WebSphere

Home > Search


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.


In the WebSphere admin 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. If you are not familiar with scopes, check out our scopes article. Select New. At Step 1, give the data source a unique name and a unique JNDI name, such as "jdbc/mySQL" or "jdbc/DB2" or "jdbc/Oracle". Select Next.

 

It is usually best to have already created the JDBC Provider so that you can choose "Select an existing JDBC provider" and then select your JDBC provider.

 

At step 3, in this example, the data source is usng the generic helper class com.ibm.websphere.rsadapter.GenericDataSourceHelper. Each helper class contains error codes for fatal exceptions. In this way, each helper class knows about different fatal errors. Typically, you'll use GenericDataSourceHelper.

 

When prompted to setup the security aliases, if you've already created the J2C alias, select the J2C alias. You will use Component-managed authentication alias if the applications that will be using the data source have Res-Auth set to "Application" or when Res-Auth is not defined. Container-managed authentication alias is used when Res-Auth is set to "Container". If you've not yet created the J2C alias, keep the settings as None and then you can configure the J2C alias and update the data source to use the J2C alias.

 

Select Finish. The new data source should now be listed. 

 


Configure the database name, port, and hostname.

  1. Select your data source.
  2. Select Custom properties.
  3. Select or add databaseName, enter your database name, and select OK.
  4. Select or add serverName, enter your server hostname, and select OK.
  5. If using MySQL, add serverTimezone, enter UTC, and select OK.
  6. Select Save.

If you selected None for the authentication alias, now is a good time to create the J2C alias and then update the data source to use the J2C alias.

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 050ea in the box below so that we can be sure you are a human.




Comments