Hi
I am working on an application which contains multiple
EJB modules,one web application and multiple standalone
java projects(Project Utility jars which assist those modules).
I am using Web Sphere 6.0 along with RAD as an
IDE.
For this project we configured one data source with a jndi name in our Web Sphere admin console. We have created a j2c authentication alias(Container-managed authentication alias by giving user name and password). Our application is using this datasource.
Here I am facing two problems.
1. I tried handling the db code(getting data source from JNDI lookup and connection) in a standalone application in my project.
Here is the code that I wrote to get the data source.
But when I try to get the connection by using ds.getConnection()....it is giving exception as ....userid is null...But I have provided userid and password to that(Even TestConnection also successful)
I tried using ds.getConnection(username,password) by hardcoding username and password...it worked for me....But Why it is not using the container managed authentication that I specified in the IBM console?
2. One more thing is I added a resource-ref to a ejb module(By referring to the JNDI db2/jndi/project in ibm-ejb-jar-bnd.xmi)ejb-jar.xml like below.
I am able to access this datasource and get connection in this EJB project(Using java:comp/env/jdbc/DataSource).
But I am not able to use this(the datasource configured above) in other EJB modules. Can I reuse the same resource-ref(The one mentioned above) in other EJB modules without configuring same jdbc/DataSource again and again?
Is it possible the datasource configured in one EJB project to be used in other EJB projects?
I tried adding the same resource-ref in Web Application web.xml, Can I use this reference in ejb modules without configuring again?
Any help is really appreciated.