Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How To Access Objects Returned From A Helper/Utility Class?  RSS feed

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a helper/utility class that specializes in
creating a connection pool and providing connections.

How do I access this Connection (conn) returned from the helper/utility class in another class? (i.e. I want to use conn.createStatement(); and query a database in TestServlet class.)
[ July 09, 2003: Message edited by: JiaPei Jen ]
 
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't you just do this:
 
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your helper is a connection pool you need logic something like this:

This has been done zillions of times. Try google for "java connection pool" to find some ready to use. Is that the kind of thing you were asking?
 
My pie came with a little toothpic holding up this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!