Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Synchronization  RSS feed

 
Anup Mahale
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I had posted a very simmilar topic in the JDBC section, I got some answers but I still am a bit confused, so here is the detailed discription of my problem:
I am designing a web applicatin where I have a few Jsp pages, some Java Bean files which are instansiated by the Jsp pages and one Java Bean file(DataBean) which takes care of the connections to the database.
For Example: I have an application which searches the database for some items depending on the search criteria entered by the user. To accomplish this I have a jsp page which takes in the user input for the search criteria, and one of the Java Bean methods is invoked by the jsp page and the user input is passed as the parameter of the method. Inside the Java Bean method the Sql statement is prepared and is sent to the DataBean where a connection is established and the sql statement is executed and the resultset is returned back to the Java Bean file.and this resultset is returned back to the Jsp page for displaying it.
Now this works fine when a single user accesses the page, but I am not sure if it work fine if mutiple users access it at the same time. If it does not work then how to I get around the problem? So please if somebody can share there ideas it would be great.
Thanks a lot.
Bye
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since connections are expensive operations, you should get a connection only once, when your application is loaded for example and keep using that connection to the database. If necessary, you could also get a connection from a pool and return it to the pool when you are done using it.
 
Anup Mahale
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I am using connection pooling.is that all I need to do?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!