i found a solution for it.

i need to close the connection on my own, but not by calling "con.close()" -
I need to call "broker.serviceConnectionManager().releaseConnection()" from
where i got the connection and than everything works fine.

thanks for your help
ben

----- Original Message ----- 
From: "Benjamin Wagner" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, October 15, 2003 5:20 PM
Subject: Re: WrappedConnection Warning after getReportQueryIteratorByQuery


> Hi,
>
> it takes me some time to implement and test it, but i still have the same
> error.
> now i don't get the warning from the WrappedConnection:
> [WrappedConnection] Closing a statement you left open, please do your own
> housekeeping
>
> but the CachedConnectionManager still closes my connection and at the next
> query i get the closedConnection Error.
>
> when i close the connection on my own, it works with some querys but not
> with all. so after some time i get the closedConnection Error.
> what me drives mad is, that after the exception, i can fire the same query
> again and everything works fine?????
>
> any ideas?
>
> Ben
>
>
>
> ----- Original Message ----- 
> From: "Armin Waibel" <[EMAIL PROTECTED]>
> To: "OJB Users List" <[EMAIL PROTECTED]>
> Sent: Wednesday, October 15, 2003 10:47 AM
> Subject: Re: WrappedConnection Warning after getReportQueryIteratorByQuery
>
>
> > Hi,
> >
> > On Wed, 15 Oct 2003 10:16:12 +0200, Benjamin Wagner
> > <[EMAIL PROTECTED]> wrote:
> >
> > > Hi again,
> > >
> > > Thanks for your reply, but this does not help me at all. Now I do get
> the
> > > warnings on every statment i
> > > execute.
> > > do you see any other ways to get around this??
> > >
> > > The statments i want to execute are mostly like this "Select
> > > vertrag_num_seq.nextval from dual" or "Select max(zug_num) from zug"
> > >
> > ok, another possibility is to lookup the connection used by
> > OJB and create the statement by your own.
> >
> > Connection con = broker.serviceConnectionManager().getConnection();
> > create Statement, execute query, close ResultSet, close Statement
> >
> > Note: close all created Statements after use, but let OJB
> > handle/close the connection.
> >
> > Maybe this will help you. In one or two weeks I will
> > try to fix problems occur when using OJB within JBoss.
> >
> > regards,
> > Armin
> >
> > > best regards,
> > > Ben
> > >
> > > ----- Original Message -----
> > > From: "Armin Waibel" <[EMAIL PROTECTED]>
> > > To: "OJB Users List" <[EMAIL PROTECTED]>
> > > Sent: Tuesday, October 14, 2003 6:26 PM
> > > Subject: Re: WrappedConnection Warning after
> > > getReportQueryIteratorByQuery
> > >
> > >
> > >> Hi,
> > >>
> > >> can you set eager-release 'false' and run your test again?
> > >> Maybe it's a side-effect of eager-release.
> > >>
> > >> regards,
> > >> Armin
> > >>
> > >> On Tue, 14 Oct 2003 17:59:50 +0200, Benjamin Wagner
> > >> <[EMAIL PROTECTED]> wrote:
> > >>
> > >> > Hi all,
> > >> >
> > >> > I need to execute my own SQL Statements by using QueryBySQL.
> > >> > I figured out that the only way to do this, is to use  the
> > >> > getReportQueryIteratorByQuery method.
> > >> > If i use getCollectionByQuery or getIteratorByQuery as writen in
the
> > >> > FAQs,
> > >> > the statment is chnaged somehow and not the one i want and need.
> > >> >
> > >> > After i execute the ReportQuery i get the correct result, but i get
> > >> the
> > >> > following warning from the jboss:
> > >> >
> > >> > WARN  [WrappedConnection] Closing a statement you left open, please
> do
> > >> > your
> > >> > own housekeeping
> > >> > INFO  [CachedConnectionManager] Successfully closed a connection
for
> > > you.
> > >> > Please close them yourself:
> > >> > org.jboss.resource.adapter.jdbc.WrappedConnection
> > >> > java.lang.Exception: Stack Trace
> > >> >         at
> > >> >
> > >
>
org.jboss.resource.connectionmanager.CachedConnectionManager.closeAll(Cached
> > >> > ConnectionManager.java:376)
> > >> >
> > >> > with a long Stack Trace.
> > >> > The Problem now is, that when i want to get some objects for the
next
> > >> > time,
> > >> > i get the following error without any db-results:
> > >> >
> > >> > INFO  [STDOUT]
> > > [org.apache.ojb.broker.accesslayer.StatementsForClassImpl]
> > >> > ERROR:
> > >> > INFO  [STDOUT] Connection handle has been closed and is unusable
> > >> > ERROR [STDERR] java.sql.SQLException: Connection handle has been
> > >> closed
> > >> > and
> > >> > is unusable
> > >> > ERROR [STDERR]     at
> > >> >
> > >
>
org.jboss.resource.adapter.jdbc.WrappedConnection.checkStatus(WrappedConnect
> > >> > ion.java:800)
> > >> > ERROR [STDERR]     at
> > >> >
> > >
>
org.jboss.resource.adapter.jdbc.WrappedConnection.prepareStatement(WrappedCo
> > >> > nnection.java:240)
> > >> > ERROR [STDERR]     at
> > >> >
org.apache.ojb.broker.util.WrappedConnection.prepareStatement(Unknown
> > >> > Source)
> > >> > .....and so on.
> > >> >
> > >> > My Code looks like this:
> > >> >
> > >> > public Object[] getObjectByReportQuery(Class target, String sql) {
> > >> >  Object[] obj = null;
> > >> >         Iterator result = null;
> > >> >
> > >> >         PersistenceBroker broker = getBroker();
> > >> >         Query q = QueryFactory.newQuery(target, sql);
> > >> >
> > >> >         try {
> > >> >             result = broker.getReportQueryIteratorByQuery(q);
> > >> >
> > >> >             if ((result != null) && result.hasNext()) {
> > >> >                 obj = (Object[]) result.next();
> > >> >             }
> > >> >
> > >> >             return obj;
> > >> >     }
> > >> >
> > >> > My only work around is to write broker.beginTransaction() and
> > >> > broker.commitTransaction() at the start and end of the function,
> which
> > > is
> > >> > not a solution for me, since the management of the transactions
> should
> > > be
> > >> > done by beans above.
> > >> >
> > >> > thanks for your help.
> > >> > Ben
> > >> >
> > >> >
> > >>
> ---------------------------------------------------------------------
> > >> > 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