Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp and databases  RSS feed

 
david allen
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created an app for managing photo albums and I have a question about design. Just say I have a function that displays all of the albums. It does this by getting the data from the database. Each time the link is selected to display the list of albums should that function open a connection to the database or should a connection be opened only once when the user first logs on.
Regards
david
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, just about everyone will tell you that there is no place for Connections in a JSP.
Secondly, there is a similar conversation happeining in the servlet forum here that you might be interested in.
Dave
 
Balan Raj
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As said earlier, JSP is not the place to hook up to the DB.
I would recommend maintaining a connection pool and picking up a connection from the pool when needed and closing the connection once done.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!