Implementing multiple connections

My web app (for deploying to tomcat) requires an embedded database to store temporary user data for faster searches. I chose Apache Embedded Derby because it integrates easily into a web application and is a pure Java database.

I also implemented pooling to fetch connections. I ran into two critical issues here (show stopper). First, My application cannot have more than two active connections at the same time. So my application just hangs.

Second, I keep getting another application that has already loaded the database. I suspect this is happening when one connection is already active and I am trying to fetch another connection from the pool.

I read that the embedded db derby can only have one connection at a time, then how it supports pooling via the EmbeddedConnectionPoolDataSource .

Should I run db in network derby or embedded server mode? I don't like the idea of ​​network mode because I need faster retrieval. Then I would rather use MySQL. And if I run the db in embedded db server mode it will support pooling and at least 50 concurrent connections or Should I just replace derby with another embedded database like H2 or HSQL as I read that derby is only for training and should not be used in a production environment? Please, help

+3


source to share


1 answer


I have implemented connection pooling with Apache commons dbcp and it works great and this is inline too.



+2


source







All Articles