Meaningless Drivel is fun!
The moose likes JSP and the fly likes How to make connection class as common?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to make connection class as common??" Watch "How to make connection class as common??" New topic

How to make connection class as common??

Murali Obla
Ranch Hand

Joined: Nov 18, 2001
Posts: 40
Hi Friends,

I have 10 jsp each page I am writing a connection class to open and close the result sets...Is there any solution to overcome this??Can I make the connection class in a seperate file(using jsp bean property) and then to instantiate in all my jsp pages passing connection URL,dsn name,User name,password...I am using sql server(query analyser) as a database and jws as web server..
please reply ASAP,
Thanks in Advance,

"Excellence is never an accident; it is always the result of high intention, sincere effort, intelligent direction, skillful execution, and the vision to see obstacles as opportunities"
Ranch Hand

Joined: Oct 30, 2000
Posts: 94
i guess u should use connection pool like Poolman or write all your db access logic in a seperate class and only expose a getConnection method of that class to your JSP's
Adam Hardy
Ranch Hand

Joined: Oct 09, 2001
Posts: 567
I would use a bean to do all the database stuff and not have a connection object in the jsp scriptlets at all.

I have seen things you people would not believe, attack ships on fire off the shoulder of Orion, c-beams sparkling in the dark near the Tennhauser Gate. All these moments will be lost in time, like tears in the rain.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

all of the above
I agree. Here's the link:
subject: How to make connection class as common??
It's not a secret anymore!