user632323
user632323

Reputation: 29

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:

  1. JDBC connction pooling
  2. Singleton class having JDBC implementation

We are using MySQL database.

Upvotes: 1

Views: 1325

Answers (1)

paxdiablo
paxdiablo

Reputation: 882028

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.

Upvotes: 2

Related Questions