Method "number at target" is called from a loop:
        for(int i=0;i<200;i++)
        {
                Long size = numberAtTarget(i,2005,1,0,0);
        }


        public Long numberAtTarget(Long programId, Long year, Long qtr,
Long value, Long type) throws FHYSPException
        {
                Query q = new QueryBySQL(ActualBean.class,
"select * from actual where year = "+year+" and  cat = "+qtr+" and
actual_info="+value+" and type = "+type+" and perf_id in (select id from
perf_desc where program_id="+programId+")");
                Collection c = getCollection(q);
                if(c==null)
                        return new Long(0);
                else
                {
                        debug("got some"+c.size());
                        return new Long(c.size());
                }
        }



        public static Collection getCollection(Query q) throws
FHYSPException{

                PersistenceBroker broker = null;
                Collection c = null;
                try{
                        broker =
PersistenceBrokerFactory.defaultPersistenceBroker();
                        c =  broker.getCollectionByQuery(q);
                }catch(Exception e){
                        LogUtils.logError(":"+e);
                        if (broker != null) broker.close();
                        throw new FHYSPException("error.database");
                }finally{
                        //System.out.println("CLOSING THE BROKER");
                        if (broker != null) broker.close(); 
                }
                return c;
        }




-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 05, 2004 11:24 AM
To: OJB Users List
Subject: Re: Maximum open cursors exceeded


Hi Mindy,

cleanup of used resources should be done by OJB itself.
I assume you use PB.getCollectionByQuery, do you use the same PB 
instance for both queries?
Can you post the complete test code?

regards,
Armin

Ribi Roland wrote:

> I'm not a OJB Guru, perhaps anyone else here can help?
> 
> It could be a bug in OJB. But I don't know the Ojb very well.
> 
> Roland Ribi
> 
> 
> 
>>-----Original Message-----
>>From: Mindy Pereira [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, May 05, 2004 5:10 PM
>>To: OJB Users List
>>Subject: RE: Maximum open cursors exceeded
>>
>>
>>If that's the problem, how do I force OJB to close the statement?
>>
>>-----Original Message-----
>>From: Ribi Roland [mailto:[EMAIL PROTECTED]
>>Sent: Wednesday, May 05, 2004 11:08 AM
>>To: 'OJB Users List'
>>Subject: RE: Maximum open cursors exceeded
>>
>>
>>This is'nt the problem of the query, this is because the
>>close() Method
>>of a java.sql.Statement-Object is'nt called after the query.
>>
>>Oracle needs to close all open cursers after the query is
>>finished. This
>>occurs after too many SQL-Calls to the database without closing the
>>cursor. You can also create this behavior whith stored procedures in
>>Oracle.
>>
>>Perhaps ojb does'nt closes the Statements in this QueryBySQL ?
>>
>>
>>
>>Roland Ribi
>>
>>
>>>-----Original Message-----
>>>From: Mindy Pereira [mailto:[EMAIL PROTECTED]
>>>Sent: Wednesday, May 05, 2004 5:02 PM
>>>To: OJB Users List
>>>Subject: Maximum open cursors exceeded
>>>
>>>
>>>I'm getting a collection beans using a QueryBySQL.
>>>
>>>Previously, it worked with no problems, however, when I
>>
>>added another
>>
>>>filter to the data set ("where X = Y and Z = 2 and W = 3"),
>>
>>I got the
>>
>>>following error:
>>>
>>>[org.apache.ojb.broker.accesslayer.StatementsForClassImpl] ERROR:
>>>ORA-01000: max
>>>imum open cursors exceeded
>>>
>>>Any help would be appreciated.
>>>Mindy
>>>
>>>
>>
>>---------------------------------------------------------------------
>>
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to