• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection pooling for different accounts

 
fedai gandjaliyev
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • 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!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35274
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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
  • 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?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65335
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic