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 make connection class as common??

 
Murali Obla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
jayram
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 567
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would use a bean to do all the database stuff and not have a connection object in the jsp scriptlets at all.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
all of the above
DOM
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic