This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to make connection class as common??" Watch "How to make connection class as common??" New topic
Author

How to make connection class as common??

Murali Obla
Ranch Hand

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

I have 10 jsp pages.in 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,
Murali


"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"
jayram
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: 566
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
Rancher

Joined: Mar 06, 2001
Posts: 13459

all of the above
DOM
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make connection class as common??