Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

make a jdbc conecction pool from 0, using JSP, tomcat, mysql

 
Carlos Salazar
Greenhorn
Posts: 5
IBM DB2 jQuery Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Carlos Salazar
Greenhorn
Posts: 5
IBM DB2 jQuery Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
IBM DB2 jQuery Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course. For instance BoneCP, C3P0 and DBCP.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic