0

I am working with oracle DB with not much experience in Java. AM trying to understand an exception (recurring) and how to avoid it

There is a monthly job, which calls the java program, and that Java program interacts with Oracle DB. Every month the program is interrupted with a exception "Connection reset by peer". All I know about the Java program is it has 20 threads and it hits the DB to fetch/insert data.

I copied the data from prod to test environment and ran the same process. There was no issues.

Could it be possible that the configuration in Prod and Dev are different ?

  1. I checked the idle time and connect time in both environments, They were set as unlimited
  2. I checked the open_cursor limit and they were same, in prod and test env.

  3. I reduced the open_cursor from 10k to 5k in lower environment, then I got maximum open_cursor exception. I found that few connections made to the DB was not closed properly. We fixed that in the code and ran it successfully in test environment (with open_cursor as 5K).

I want to know,

  1. Should I check which configuration/parameter made it run in test env?
  2. Will abandoning connections result in Connection reset by peer exception?
  3. Test env is least used and prod DB is used by many jobs. Is that making a difference?

1 Answer 1

1

This happens when application has made db connection but there is no activity happen for any transaction. As your db operation interval is monthly. If you are using c3p0 connection pool it has functionality for running test query in background.which removes abandoned db connections from pool.

If you are using some other connection pool it will be having such functionality. Or for hack you can write a polling thread which will do a random db operation at configured time interval(9 hours in MySQL case). So db connections will be always active.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your reply. So from your post I understand that it is more about the idle time- Does it depend upon the DB configuration? Because am not seeing this exception in other environments
@Valli connection_time is available at both db & db configuration level. both should be synch as per idle situation time interval.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.