| Author |
make a jdbc conecction pool from 0, using JSP, tomcat, mysql
|
Carlos Salazar
Greenhorn
Joined: Jul 21, 2011
Posts: 5
|
|
Use case:
1.- generate 5 connectios...for all user
> login(JSP) <--> servlet doPost <---> Conn.java
Connection conn; <--(eg. Connection A)
private boolean inuse;
when search inuse = true
when finished inuse=false
> other user, login(JSP) <--> servlet Detect Connection A.inuse=false, then use it
without created other connection(use one from pool)
Reason:
I do not want to depend on the configuration of tomcat to the pool implementers
What do you recommend?
what are the best practices?
Best Regards
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
Not sure why you decided to place it in the "Features new in Java 7" forum. Trying the JDBC forum.
I best practice I know of is: don't reinvent the wheel. Use existing solutions.
|
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
|
 |
Carlos Salazar
Greenhorn
Joined: Jul 21, 2011
Posts: 5
|
|
I'm wrong and I did not find the option to move or remove the post.
I do not want to reinvent the wheel.
I have more control of the code,so, know where an error.
tomcat pool, I think a black box.
I think someone could give me some idea.
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
|
It's designed to be a blackbox. You often don't need to know the internal workings of the pooling mechanism. But if you do you can always view the source code.
|
 |
Carlos Salazar
Greenhorn
Joined: Jul 21, 2011
Posts: 5
|
|
so as you say makes sense.
I will use the pool of tomcat.
but this brings me to another question,
are there other pool that can be used?
|
 |
Wouter Oet
Saloon Keeper
Joined: Oct 25, 2008
Posts: 2700
|
|
|
Of course. For instance BoneCP, C3P0 and DBCP.
|
 |
 |
|
|
subject: make a jdbc conecction pool from 0, using JSP, tomcat, mysql
|
|
|