0

My first Approach: I am developing a project where i am using Mysql with JDBC. What I am doing, I have fixed number of query. So i am creating a database connection and over same connection I am creating map of preparedstatement for all query. When i have to execute any query, I am taking preparedstatemtn from Map, executing and not closing preparedstatement after completing query execution. To support from multiple thread applying lock on preparedstatement.

Another Approach:

I can create a database connection pool. when i need to execute query, i shall retrieve a connection from pool, create statement/preparedstatement on it, execute and close.

i am confused which approach will be more effiecient? as my environment is multi threaded

user2700945
  • 11
  • 1
  • 4

0 Answers0