• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Interview question - Connection Pool

 
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys

I came from a very depressing interview yesterday(It felt like the interviewer didn't like my answer).

Anyway, the question was "How will you do connection pooling in a Servlet".

I had an answer, the first thing that came into my mind was that there was a connection pool mechanism in tomcat. But he wasn't satisfied to he insisted on how will I do it in a Servlet. I didn't know the exact steps (but I swear it was in the back of my mind).

So the help I'm asking you now is... How will you answer this question in let's say... No more than a minute? Thanks!
 
Author
Posts: 6055
8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Um. maybe I'm getting rusty but my answer would be...

I wouldn't put a connection pool in a servlet; it breaks the model. The connection pool should be done by by the container.

--Mark
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks

Yeah, your suggestion makes sense. It shouldn't be in a Servlet(thus, my idea that tomcat has a built-in mechanism). I guess I wasn't able to answer well because of the time pressure. There were lots of applicants there.

Thanks again!
 
author and cow tipper
Posts: 5009
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if I'd want to work for a person that would put connection pooling in a Servlet.

How do you access a connection from a pool in a Servlet? That's a valid question. But a pooling mechanism should be factored out into a separate service a variety of resources could access.

-Cameron McKenzie
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Cameron McKenzie:
I'm not sure if I'd want to work for a person that would put connection pooling in a Servlet.

How do you access a connection from a pool in a Servlet? That's a valid question. But a pooling mechanism should be factored out into a separate service a variety of resources could access.

-Cameron McKenzie



Yes, but if some one forces you to answer the question, they might want to rephrase it. Like, where would you acquire and release connections in a servlet if the container does not give you a mechanism to pool connections.

Either way interviews can be really hard on you sometimes. Dont be so hard on yourself. It happens. Next time try to relax.
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Timothy Sam:

How will you answer this question in let's say...


I know one of my friends working on a project, which uses a proprietary framework on top of servlets and they have written their own custom connection pooling mechanism.

I am not aware what forced them to write it by themselves but I guess the interviewer was looking for this kind of answer.
 
Timothy Sam
Ranch Hand
Posts: 751
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It could've been better if he asked me to explain the concept of connection pooling! Lolz!
 
Srikanth Basa
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps there is nothing you can do in situations when the interviewer has something specific in mind but fails to express it. As you said, he could have asked the you to explain connection pooling but as this is a very common question, he might have tried to come up with some creative question but failed successfully in framing it
[ October 29, 2007: Message edited by: Srikanth Basavaraju ]
 
Author
Posts: 3473
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Probably the interviewer was expecting the answer that it is not a best practice to have a connection pool in the servlet. SOme interviewrs ask tricky questions like this to perplex the candidate. For example What is the "const" keyword used for etc.
[ October 29, 2007: Message edited by: arulk pillai ]
 
Ranch Hand
Posts: 1327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
do not reinvent the wheel
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A relevant article

http://www.webdevelopersjournal.com/columns/connection_pool.html
 
reply
    Bookmark Topic Watch Topic
  • New Topic