|
| Hi All,
I am facing a problem in WebSphere Application Server when using jdbc datasource.
I have created JDBC datasource named "jdbc/myDataSource".
Code i use:-
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.Websphere.naming.WsnInitialContextFactory");
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("jdbc/myDataSource");
This works fine but gives warning in the server logs as:-
"I J2CA0122I: Resource reference jdbc/myDataSource could not be located, so default values of the following are used: [Resource-ref settings]
res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)
I J2CA0107I: Component-managed authentication alias not specified for connection factory or Data Source myDataSource."
If i use
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/myDataSource");
it gives error as:
Name comp/env/jdbc not found in context "java:".
I referred this link :- http://www.webspherepower.com/issue...0/00001357.html
It says that i should create alias and use it. But i dont have WebSphere Studio Application Developer. So how do i create one???
I tried putting this in web.xml of my application
<resource-ref id="ResourceRef_1042443188222">
<res-ref-name>jdbc/myDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
and in ibm-web-bnd.xmi (binding)
<resRefBindings xmi:id="ResourceRefBinding_1042448130198" jndiName="jdbc/myDataSource">
<bindingResourceRef href="META-INF/web.xml#ResourceRef_1042443188222"/>
</resRefBindings>
Still didnt solved my problem.Please help me..
|
|