Create J2C alias in WebSphere

Home > Search
  by

Before creating a J2C, you will probably want to create the data source.

  1. Select your data source.
  2. Select JAAS - J2C authentication data.
  3. Select New.
  4. Give the J2C alias a name, provide the username and password to connect to the database, and select OK.
  5. Select Save.

 

Now that you've created the J2C alias, you'll want to configure a data source to use the J2C alias. Select your data source. In the Component-managed authentication alias or Container-managed authentication alias, select the J2C alias you just created and select OK. You would use Component-managed authentication alias if the application using the data source has "Application" as the res-auth policy in the Deployment Descriptor. You would use Container-managed authentication alias if the application using the data source has "Container" as the res-auth policy in the Deployment Descriptor. If the Deployment Descriptor has not specified a res-auth policy, the default is "Application", which means you would only use Container-managed authentication alias when an application has specified "Container" as the res-auth policy.

 

  1. Select Save.
  2. Restart the application server and/or deployment manager.
  3. Check the data source and select Test connection. You must have the Administrator or Operator role to be able to test conection. If the connection is successful, the following message should be displayed.

 

Likewise, when an application that is configured to use JDBC to make a database connection, the application should be able to connect to the database. For example, let's say there is a Java app that contains the following markup to connect to a MySQL database.

Connection conn = DriverManager.getConnection("jdbc:mysql://www.example.com:3306/database_name","username","password");

 

When the app resides on WebSphere, the app will know to use the MySQL data source when connecting to the database. In this example, the application is able to connect to the database.

 



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 in the box below so that we can be sure you are a human.




Comments