• 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

Hot Deploy DataSource in Tomcat?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

My web application need to connect to many databases by using multi datasource. But the datasources is not allowed to be in the server.xml file when the Tomcat 5.5 is start up. It (datasource) must be configurated when Tomcat is already start up.

Do you have any solution to deploy a datasource when Tomcat is start up without restarting the Tomcat (hot deploy) ?

Thank you and regards,
Hien Vo
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I sounds like you're not going to be able to use container managed connection pooling.

Out of curiosity, what is your app doing that requires it to be able to connect to multiple datasources that it doesn't know about at startup?
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might want to try putting all your Datasources in the Context.xml and place it in the META-INF folder of your application. Usually Context.xml is not present in an app, so you'll need to create it.
 
Vo Hien
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ben,
I am developing two different web apps A and B. I deploy them in the two Tomcat servers (different port) on the same computer.

Web app A is an add-on of web app B.
One web app A can have one to many web app B.
Depend on the request from the browser, the database conective information (datasource) will be identified. This information will be used in the datasource for the conection to the database. This means that the datasource is identified when Tomcat is start up but it is a must for the connection to the database.

So my question is:
If I write the datasource information to the server.xml file when Tomcat 5.5 is start up. WILL THE HOT DEPLOY OF DATASOURCE HAPPEN?


If the hot deploy happens, what about the time it takes to redeploy (this is necessary for the app performance)?

Regards
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, typing in caps is considered yelling in a forum.
There's no need to yell.

If you're restarting Tomcat, then you're not talking about a hot deploy.
'Hot' means that that the item (usually a web application) is deployed without having to restart the container.

You can certainly set up two datasources in a single instance of Tomcat as long as they have unique names.
Once you've done that, your app can decide which of them to use by using the appropriate JNDI string when getting a connection.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic