This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
i have a java batch client ( Application client) that reads the DB2 user Id and Password from the property file and establishes the connection to perform database operations.
I have been requested not to put the user id and password explicitly on the property file for security purpose. So, i have to find a way to retrieve the credentials from the websphere. I tried the follwoing 2 options
1. Trying to read the jaasAliasName and get teh user id and Password, But we got an exception while running it . This is not helping me. Looks like the jaasAlias name is not visible to the application client.
No, that's not what you want to do. Configure the credentials in Websphere, yes. Retrieve the credentials in your application, no. Instead, configure a data source in Websphere, have it use those credentials, and then use the data source in your application.
Joined: Jul 07, 2011
My batch program uses hiberante to for DB2. It needs the user id and password to make a connectivity at runtime( when run though a launch client approach). Right now my program reads the user id and password from the property file and dose the connection.
// Reading from the property file
String userName = SPMUWPropertyProvider.getProperty("sp.muw.sics.hibernate.connection.username");
String password = SPMUWPropertyProvider.getProperty("sp.muw.sics.hibernate.connection.password");
// Setting user id and pass to the hibernate config
sessionFactory = cfg.buildSessionFactory();
In websphere, under datasource ( Resources--> jdbc provide --> datasource), i have created a data source and provide a jndi name. I was thinking, if there is a way to retrive the user id and password from the datasource configured on the websphere so that i can pass it to the above block of code.