Forum Stats

  • 3,876,226 Users
  • 2,267,082 Discussions
  • 7,912,474 Comments

Discussions

Can this code cause a connection leak? Row r = viewObject.first();

Pamela
Pamela Member Posts: 203 Bronze Badge

JDeveloper Version 11.1.2.4.0.

Often in my application instead of using the following code:

ViewObject vo = am.getMonthlyWeeklyDhrSumView1();

vo.executeQuery();

RowSetIterator rsIterator = vo.createRowSetIterator(null);

rsIterator.reset();

Row row = rsIterator.first(); //use the first row after that...

rsIterator.closeRowSetIterator();  

I am using the following code to get the first row of a view object:

ViewObject vo = am.getMonthlyWeeklyDhrSumView1();

Row row = vo.first();

and not closing anything.

Is it possible that this is causing a connection leak?

It worked well for many years until recently I am starting to get an issue and I see a lot of inactive sessions with this view object that is executing on every row selection of a specific table...

Tagged:

Answers

  • Timo Hahn
    Timo Hahn Senior Principal Technical Consultant - Oracle ACE Director Member, Moderator Posts: 38,931 Red Diamond

    The code should not cause a connection leak. vo.first() uses the default rowsetiterator. The other code creates its own default iterator and releases it after the work has been done.

    Have you tried this in the current version 12.2.1.4? do you see the same behavior there?

    You might have found a bug in your version. If you don't see the behavior in the current version, you should file an SR with support.oracle.com and ask them for a fix.


    Timo

  • dvohra21
    dvohra21 Member Posts: 14,692 Gold Crown

    First, find if any connection leak issues exist. Enable Connection Leak Profiling.

    Detail at Diagnosing Connection Leaks in an ADF Application Running in WebLogic (Doc ID 2726546.1)