• 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

Connection pooling for different accounts

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!
I was walking thru the net to get to know how to use
connectiong pooling and I found some articles describing that process.
All of them were basically done with servlets!
All articles recommend to create a ConnectionPool object
at the servlet initialization and it's good!
But the constructor of the ConnectionPool object takes
the url, username, password etc...
As I understand the pool is created for one user only.
I'm using an applet-servlet communication and the user supplies
username and password and I'm not that good at connection pooling yet!
So I need Connection pooling for different users!
How should I create the ConnectionPool object in this case?


Thank you very much, Feadi!
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Feadi,
Normally on a server side application, there is one database user that accesses the database on behalf of different users.

If your users have separate accounts, the value of connection pooling is quite limited. A good alternate would be to create a connection on receiving the applet request and use it for all subsequent request before returning to the applet.
 
fedai gandjaliyev
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But the servlet is going to be accessed by multiple users at the same time!
Putting a new Thread class into the doGet() or doPost() method doesnt seem to work!
Will HttpSession help in this case?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why would each of your users need their own database account? Are you confusing users of your web application with users of the database? They are almost always separate concepts.
 
fedai gandjaliyev
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What I'm trying to deploy is a payment system!
Only valid users can perform payment and the applet should verify if the user whicn logs into the database is a valid user and therefore can perform payment! This is why I have so many different accounts!
All I need to do is to make so that the servlet, AuthenticationServlet in my case, can handle multiple requests at the same time in case of multiple users trying to connect to the database and send a response to the applet saying if the user is a valid one!
reply
    Bookmark Topic Watch Topic
  • New Topic