• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

change my BMP's datasource name during runtime?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic