Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

change my BMP's datasource name during runtime?  RSS feed

 
Kamal SampathKumar
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i change my BMP's datasource name during runtime? I have a login page to let me to choose which datasource i need, for example, jdbc/datasource1 and jdbc/datasource2. After i choose a datasource name, how can i pass it to my BMP and based on the datasource name and hence i can retrieve data from different database. Pls advise. Thanks.
Kamal
 
Sudd Ghosh
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The datasource name goes in the XML DD, right ? I think you need to restart the app server for the server to pick the new datasource even if you're able to change it. If you can live with this restart, then here is my suggestion.
After reading the new datasource name, programatically change the XML DD for the resource-ref, res-ref-name elements in the DD. Then somehow programatically you've to restart the app server.
Thanks
 
Razi Abbas
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you just have two datasources to select from or can it be a long list. If there are just two, you can register both of them with the application server and then include both of them in the EJB deployment descriptors. Then you can use either one of them in your program depending on the selection.
If the list of possible datasources is long then thats probably a much more compilcated issue and I can't think of a way to do it cleanly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!