1

I have EAR with one web application inside. In this web application I get a data source reference through JNDI. So I have a JDBC type resource reference in my web.xml:

<resource-ref>
    <description>TCCC Database</description>
    <res-ref-name>jdbc/tccc</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>  

I have to deploy my EAR to WebSphere App Server 7.0 and for my resource reference (jdbc/tccc) I must specify a JNDI name in order to bind this logical name to the physical location of the DB resource.

I successfully set up and configured a JDBC provider, data source and security settings on my WAS instance according to the documentation. And using web administration console I've deployed my EAR binding manually on some step HOST and JNDI so that ibm-web-bnd.xml looks like:

<virtual-host name="default_host"/> <resource-ref name="jdbc/tccc"
binding-name="jdbc/tccc/oracle "/>

Where “jdbc/tccc/oracle” is a JNDI name for the datasource that I configured on WAS. Everything is working fine.

But now I want to do all deployment just by using ws_ant and appropriate tasks like InstallApplication, UninstallApplication etc. I've created an appropriate build.xml file with needed tasks and now can uninstall and install my app. But how can I bind app JNDI name to JNDI name of datasource on server. Using defaultBindings task I can bind host to default_host. How I can achieve the same with JNDI. I've been trying to set defaultDataSource argument in defaultBindings task but it always creates ibm-web-bnd.xml with the same binding-name value:

<virtual-host name="default_host"/> <resource-ref name="jdbc/tccc"
binding-name="jdbc/tccc "/>

Importang thing: I have to bind resource reference only during deployment to bind to different datasources in future.

jasper.ua
  • 11
  • 1
  • Can you always bind to the same JNDI name, and just change the settings of that DataSource as needed in the future? If so, you can pre-create the .xmi file(s) and include them in your built WAR. – dbreaux Mar 07 '12 at 14:43
  • I've been thinking about that. For me it seems this solution is not so flexible of course. For development i guess this's suitable solution and perhaps if during deployment on QA or production server people will be able to override settings that are inside of WAR that would be enough. Thanks anyway. – jasper.ua Mar 08 '12 at 07:46

0 Answers0