Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
JiaPei Jen
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 ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouldn't you just do this:
 
Stan James
(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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic