I am using JDBC in a web project. Many user can access the site at the same time. I don't know much about connection pooling, I just heard the term. So I thought this new approach:
I will create a connection object for each user at first visit of user and set it into session attribute of that user and whenever this user will perform some kind of database operation, I will get the same connection object from session and use it....
Please tell me, how is this approach... Any major drawback???
Many major drawbacks - right offhand I can think of: 1. If the site is at all busy you will open MANY more connections than you need and may run into a limit imposed by the database. 2. Every user will experience an extra delay as the connection is opened (as opposed to a minium delay with a connection pool). 3. If the database side closes a Connection the session will be unusable. You should expend you energy in understanding how connection pools work. Bill