• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to share database connection pool across multiple JVM?  RSS feed

 
LGu Gu
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • 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?
 
Mark Webb
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JNDI would work, as you could use it as a thread pool. Another option would be RMI.
 
Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • 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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!