Which is better: JDBC Connection pooling, or using SIngleton class for JDBC Connection?
We already have a web application (medium sized) which involves a lot of Database operations.
We have to change the existing 开发者_运维知识库code which is really affecting the performance of the application. As of now for each database connection new connection is made and then closed.
To improve performance in JDBC, which would be better:
- JDBC connction pooling
- Singleton class having JDBC implementation
We are using MySQL database.
Well, a singleton class would only give you one connection presumably. If you have a lot of database operations, you don't want to serialise them that way, especially since a decent database, and hopefully your web application, is more than capable of running lots of concurrent operations.
Pooling would be better.
精彩评论