简体   繁体   中英

Oracle 19c JDBC (Instant client basiclite) driver Issue

I working on upgrade the oracle jdbc driver from 11g (ojdbc6.jar) to 19c (ojdbc8.jar) in my java application, driver used is Instant Client (instantclient-basiclite-nt-19.11) with JRE1.8.0_271. After change to 19c, my application keep hit "ORA-02396: exceeded maximum idle time, please connect again" or "ORA-03113: end-of-file" error.

In oracle database properties, there are some limitation set, Idle-Time = 2 minutes and Connection-Time = 10 minutes. But I will not do any change on database because this may cause high CPU if many users are using the application at the same time.

In Java application, connection is stored in connection pool, I put the logging and can see that connection is closed and return to connection pool after finish execute. But when I run the application again after 2 minutes, the oracle error raised.

If I switch back to 11g, I don't get such error and application is working fine after 2 minutes. No change in code.

Is this BUG in latest oracle driver? I saw there is UCP.jar (Universal Connection Pool) package available in 19c but not in 11g, is it I have implement this? and how?

Your problem has nothing to do with the driver but with a database profile setting that limits the maximum allowed idle_time. Normally this is done to get rid of forgotten sessions.

You can check this using

select a.username,b.profile,b.RESOURCE_NAME,b.LIMIT from dba_users a, dba_profiles b where  b.resource_name='IDLE_TIME' and a.profile=b.profile;

find which profile is used for your user and see if your dba is willing to change the limit.

if this happens to be the default profile it could be changed to unlimited by

ALTER PROFILE DEFAULT LIMIT IDLE_TIME UNLIMITED;

but it might be better to create a custom profile for your user.

If the IDLE_TIME limit can not be changed, run a query every once and a while, like select 'keep me alive from dual; This also prevents closure by firewalls.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM