UweBritfeld
Programmer
This may sound remedial but I'm running into a problem.
I've got a Websphere 4.0 server with both an IT and a DEV environment on it. I've created two Applications, one for DEV and one for IT.
I have a datasource for each: jndi/DBDev and jndi/DBIT.
As I move my code from Dev to IT, when I look up the datasource via JNDI, I don't want to have to change my ctx.lookup() when I change environments.
i.e.
ds = (DataSource)ctx.lookup("jdbc/DBDev" in dev and
ds = (DataSource)ctx.lookup("jdbc/DBIT" in IT.
My understanding is that I can accomplish this by creating entries in web.xml and ibm-web-bnd.xmi but it isn't working for me.
Here's what I have in web.xml:
<resource-ref id="ResourceRef_1">
<res-ref-name>DB/Chrome</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In ibm-web-bnd.xmi in DEV I Have:
<resRefBindings xmi:id="ResourceRefBinding_1" jndiName="jdbc/DBDev">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1"/>
</resRefBindings>
And in ibm-web-bnd.xmi in IT I Have:
<resRefBindings xmi:id="ResourceRefBinding_1" jndiName="jdbc/DBIT">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1"/>
</resRefBindings>
I thought I could then do a lookup in JNDI for "DB/Chrome" in either environment and wind up pointing at the proper Datasource.
My problem is that JNDI can't find "DB/Chrome" at all. If I do the lookup on "jdbc/DBIT" or "jdbc/DBDev" it works fine.
My only other option is to specify the datasource name using a parameter.
Has anyone tried this, or am I way out in left field?
I've got a Websphere 4.0 server with both an IT and a DEV environment on it. I've created two Applications, one for DEV and one for IT.
I have a datasource for each: jndi/DBDev and jndi/DBIT.
As I move my code from Dev to IT, when I look up the datasource via JNDI, I don't want to have to change my ctx.lookup() when I change environments.
i.e.
ds = (DataSource)ctx.lookup("jdbc/DBDev" in dev and
ds = (DataSource)ctx.lookup("jdbc/DBIT" in IT.
My understanding is that I can accomplish this by creating entries in web.xml and ibm-web-bnd.xmi but it isn't working for me.
Here's what I have in web.xml:
<resource-ref id="ResourceRef_1">
<res-ref-name>DB/Chrome</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In ibm-web-bnd.xmi in DEV I Have:
<resRefBindings xmi:id="ResourceRefBinding_1" jndiName="jdbc/DBDev">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1"/>
</resRefBindings>
And in ibm-web-bnd.xmi in IT I Have:
<resRefBindings xmi:id="ResourceRefBinding_1" jndiName="jdbc/DBIT">
<bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1"/>
</resRefBindings>
I thought I could then do a lookup in JNDI for "DB/Chrome" in either environment and wind up pointing at the proper Datasource.
My problem is that JNDI can't find "DB/Chrome" at all. If I do the lookup on "jdbc/DBIT" or "jdbc/DBDev" it works fine.
My only other option is to specify the datasource name using a parameter.
Has anyone tried this, or am I way out in left field?