aspose file tools
The moose likes JDBC and the fly likes Connection pooling for different accounts Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Connection pooling for different accounts" Watch "Connection pooling for different accounts" New topic
Author

Connection pooling for different accounts

fedai gandjaliyev
Ranch Hand

Joined: Dec 05, 2005
Posts: 99
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 26193
    
  66

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
fedai gandjaliyev
Ranch Hand

Joined: Dec 05, 2005
Posts: 99
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

Joined: Jan 10, 2002
Posts: 56204
    
  13

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.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
fedai gandjaliyev
Ranch Hand

Joined: Dec 05, 2005
Posts: 99
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!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Connection pooling for different accounts
 
Similar Threads
How does the GC prog identify that the object is not being associated
How to share a user-connection between two projects
Servlet handling multiple requests from applet
Running servlet from bean
Maintaining scalability in servlets programming