• Post Reply Bookmark Topic Watch Topic
  • New Topic

What approach is good between two for database Interaction?

 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there

I am working on a web application project.I have a seneraion where I need to get user information like their profile,messages and notifications(like Facebook but I am not designing another facebook or stuff like that)

I am thinking two approach for this.
1)Verify user in the LoginVerify Servlet and then fetch required Information from database(Based on Some Id).then set all values in the Object ,and get those value in JSP using request parameters.

2)Get Id from session,call to database based on that Id and then set all values in JSP page.


Which one will be good for a table of 10millon rows and many Interlinked Foreign Keys

And why other is better than other a little bit explanation.

Thanks
 
Jude Niroshan
Ranch Hand
Posts: 132
5
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Minimize the Database Read/Writes.(Use Indexes on frequently reading tables for meaningful columns. Keep in mind that using indexes will slow down the Updates)
Never call Databases from JSPs.(Follow MVC pattern | Bad Design)

1) approach is quiet ok. Try to implement the design considering the above two facts. Those are very famous; there are many other rules that you need to be ad-hoc with other than these two.
 
Kishor Joshi
Ranch Hand
Posts: 674
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jude Niroshan

Thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!