aspose file tools*
The moose likes Java in General and the fly likes How To Access Objects Returned From A Helper/Utility Class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How To Access Objects Returned From A Helper/Utility Class?" Watch "How To Access Objects Returned From A Helper/Utility Class?" New topic
Author

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

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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

Joined: Jan 30, 2002
Posts: 3451
Wouldn't you just do this:


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
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?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Access Objects Returned From A Helper/Utility Class?