How to setup authentication alias in WebSphere Application Sever?

If your application is deployed on WebSphere application server and is using its JDBC resources for making a database connection then you need to specify the security credentials. If the proper security credentials are not set or specified then you may end up getting the below error.

Authentication Alias Websphere JNDI Data source Exception Connection Failed

There are 2 ways of achieving this.
  1. The easiest way is to hard code the userID / Password in your application which is not at all recommended for enterprise applications.
  2. Second option is to create a component managed authentication alias in WAS which involves creating a mapping of a alias name with the specified userID/password. This alias can be later used while creating a connection factory or a data source.
 Below are the simple steps for creating an alias using WAS console,

1. Open WAS admin console using this URL https://localhost:9080/ibm/console.
Authentication Alias
Authentication Alias
2. Navigate to Security -> Secure administration, applications, and infrastructure -> JAAS -> J2C authentication data.
3. Click New to create a new alias and enter the alias name.
5. Enter the userID/Password for connecting to the database.
6. Click OK to finish.

Now while creating data source for you application to connect to database, you should use this alias name. This was you can avoid hard coding userID / Password in your application code for creating database connection.

No comments:

Post a Comment