This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Shared DB Connection Pool

 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone of you folks, know any framework/library/API which provide DB connection pool which can be shared among multiple applications. I mean, applications are deployed on separate machines, running under different JVMs, but sharing a single DB Connection Pool.

Thank you very much.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any app server that provides JNDI can potentially allow external access to the JNDI resources and hence the DataSource managing Connections
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
any app server that provides JNDI can potentially allow external access to the JNDI resources and hence the DataSource managing Connections


Yup.

How about if no application server? I believe, the URL i.e. is not meant to access remote resources. For remote resources, one might need something like,

I believe. However, I am looking to use a connection pool out of application server, say, commons dbcp or c3p0. Please provide me some more insight.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am still thinking 'JNDI', it can be backed by DBCP or anything as long as it exposes a DataSource to external clients.

I'm trying to remember how we did something like this ages ago, but I imagine it would be possible to get just the 'JNDI' part of a JEE somewhere.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David O'Meara:
I am still thinking 'JNDI', it can be backed by DBCP or anything as long as it exposes a DataSource to external clients.

I'm trying to remember how we did something like this ages ago, but I imagine it would be possible to get just the 'JNDI' part of a JEE somewhere.


Exactly. I proposed the thing with JNDI in my mind, now trying to help myself.

Moreover, the URL I have given are meant to be used with JNDI. But I am afraid, that I would need an application server just to use JNDI or might need to write some kind of service - using RMI or something - to expose the resource.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks, quite sound.
Thank you, David. Will try it out.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Really I have no idea, but if it works out then feel free to come back and tell us! It sounds like an interesting exercise
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure thing.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fscontext, that's the one.
Have a read of this
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems, few significant pages are not the part of the preview.

It doesn't show anything like how we get the datasource from a remote machine. I mean the details are missing or I am missing. It looks like that it meant for sharing across different JVMs and Machines, though. Do you have any experience with this?

Or otherwise, we should look into rmi-based thingy. What say you?

Thanks you for the link. Greatly appreciated.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It turns out I have a similar problem in need of this solution.

We have code running in a Tomcat server, using a server managed DataSource to provide Connections.

Many classes fail when called during testing, since they need to find the InitialContext and cannot do so when testing via JUnit. While we could look at running these tests within the container I am always hesitant about combining test and production code.

The current view is that we use the fscontext in the TestCase super class to initialise the file based JNDI and make Connections available to classes that expect one.

Maybe.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dropped the idea, it was contradicting the notion, "Separation of Concerns". We replaced it with a DataAccessService objects. Now, the Master - Master/Worker pattern - need not handle connections and related stuff, instead call the service and get the result.

Cheers.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic