2

I have a Single threaded standalone jdbc application. In this application, I will retrieve data from one data source and insert in the another. Before inserting them, I will clear the target data source, and make an entry saying that I am inserting, and then I insert the data in a different table of that target datasource.

Currently we are opening the connection at the start of the application and we are using the same until we finish inserting them. Is this a good approach?

We are sometimes getting connection closed or reset error. But not sure whether this is becauz we are holding the connection idle for long time (atleast 40 mins).

I suggest them to use Hikari CP and use the connection from the pool. So we don't need to hold the connection, as Hikari will manage them. Even if connection closed and comes again, Hikari will attempt to get the fresh connection, so we don't get connection closed or reset error.

Appreciate your opinion in this matter.

Manoj
  • 5,707
  • 19
  • 56
  • 86
  • Refer this question http://stackoverflow.com/questions/457287/what-is-the-benefit-of-connection-and-statement-pooling – Yogesh Kulkarni Apr 24 '16 at 13:27
  • I understand, but it is not answering my question. I know database pool is a better choice, but when? In my case? – Manoj Apr 24 '16 at 16:22
  • Maybe, maybe not. It is hard to tell from this description. And as such it is either too broad, or primarily opinion based. – Mark Rotteveel Apr 25 '16 at 07:51

0 Answers0