You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Da...@equifax.com on 2002/12/20 20:52:11 UTC

OJB clean up

I'm running 0.9.4  I have code that amounts to something like this.




        odmg = OJB.getInstance();
        //open database
        db = odmg.newDatabase();
        db.open(repositoryXml, Database.OPEN_READ_WRITE);

        retrieveAll(foo.class)

        PersistenceBrokerFactory.releaseAllInstances();
        db.close();

    public List retrieveAll(Class type)
    {
        StringBuffer query = new StringBuffer("select o from ");
        query.append(type.getName());

        return executeQuery( query );
    }

    public List executeQuery( StringBuffer query )
    {
        try
        {
            Database db = odmg.getDatabase(null);
            OQLQuery oqlquery = odmg.newOQLQuery();
            oqlquery.create(query.toString());
            org.odmg.DList result = (org.odmg.DList) oqlquery.execute();
            return result;
        }
        catch (Exception ex)
        {
            throw new RuntimeException(ex);
        }
    }


However, when it's done, there appear to be some database connections held
open.  Any idea what resource I"m not freeing, or is there a way to tell
"the pool" to let go of everything?

Thanks
David


This message contains information from Equifax Inc. which may be
confidential and privileged.  If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited.  If you have
received this transmission in error, please notify by e-mail
postmaster@equifax.com.



Re: OJB clean up

Posted by Thomas Mahler <th...@apache.org>.
Hi again David,

You should upgrade to some newer version. pooling and connection 
handling has improved a lot in the last months.

I will assemble a new 0.9.8 release this weekend that will also contain 
the fix for your DList.remove() problem!

cheers,
Thomas

David.Corbin@equifax.com wrote:
> I'm running 0.9.4  I have code that amounts to something like this.
> 
> 
> 
> 
>         odmg = OJB.getInstance();
>         //open database
>         db = odmg.newDatabase();
>         db.open(repositoryXml, Database.OPEN_READ_WRITE);
> 
>         retrieveAll(foo.class)
> 
>         PersistenceBrokerFactory.releaseAllInstances();
>         db.close();
> 
>     public List retrieveAll(Class type)
>     {
>         StringBuffer query = new StringBuffer("select o from ");
>         query.append(type.getName());
> 
>         return executeQuery( query );
>     }
> 
>     public List executeQuery( StringBuffer query )
>     {
>         try
>         {
>             Database db = odmg.getDatabase(null);
>             OQLQuery oqlquery = odmg.newOQLQuery();
>             oqlquery.create(query.toString());
>             org.odmg.DList result = (org.odmg.DList) oqlquery.execute();
>             return result;
>         }
>         catch (Exception ex)
>         {
>             throw new RuntimeException(ex);
>         }
>     }
> 
> 
> However, when it's done, there appear to be some database connections held
> open.  Any idea what resource I"m not freeing, or is there a way to tell
> "the pool" to let go of everything?
> 
> Thanks
> David
> 
> 
> This message contains information from Equifax Inc. which may be
> confidential and privileged.  If you are not an intended recipient, please
> refrain from any disclosure, copying, distribution or use of this
> information and note that such actions are prohibited.  If you have
> received this transmission in error, please notify by e-mail
> postmaster@equifax.com.
> 
> 
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 
> 
>