• 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

How to share database connection pool across multiple JVM?

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have several individual Java programs, and they each have their own database connection pool. Is there a way that I can have a shared connection pool among all my Java programs? JNDI?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JNDI would work, as you could use it as a thread pool. Another option would be RMI.
 
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RMI would work I suppose, but thats a lot of effort to just have them all share a DB connection pool. Couple of questions first before I can say if RMI would be worth it.
Are all of your programs independant of each other(you start them all with their own JVM)? Or can you meld them all together into a single program that can run them all at once? If you can meld them, then your problem is solved with a single DB connection pool that they all share. If they are not meldable, then you are incurring a lot of overhead anyways with the multiple JVMs running at once and pooling DB connections is most likely a minor issue.
Are the programs being run on separate machines? If they are, then RMI may indeed be your best solution with a server set up to handle all db transactions. If you have many different transaction types, tho, you will most likely have to set up a method for each type of transaction you are wanting to do since you probably can't actually pass a ResultSet back through RMI since it is dependant on the DB being there when you try to access the values the resultSet points to.
Not sure if this helps you much, but it will give you somethign to think about.
Chris
reply
    Bookmark Topic Watch Topic
  • New Topic