This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using SQL in a JSP  RSS feed

 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know it is a bad practice to use SQL codes and database connection code in a JSP. I want to know is there a performance drawback by using SQL codes and database connection code in a JSP. What are the other drawbacks of doing that?
 
Muhammad Saifuddin
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Database connection is something comes under Business Logic Layer. Using business logic directly in JSP is something like killing the purpose. You are mixing the Presentation Layer with Business Logic Layer.

separation of these layers is counted as best practice and helps developer to makes the code more maintainable.
 
Dilshan Edirisuriya
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Yes i know that i'm asking is there any performance drawback by doing that.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the reasons to separate your code have nothing to do with performance.

That being said, well structured code is more open to different optimization strategies (caching results, etc...).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!