Bugs item #990142, was opened at 2004-07-13 13:19
Message generated for change (Comment added) made by ejort
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=990142&group_id=22866

Category: JBossCX
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Submitted By: David Boon (davidmboon)
Assigned to: Adrian Brock (ejort)
Summary: 3.2.4 needless warning about unclosed resultset

Initial Comment:
The api for java.sql.Statement indicates that when you
close a statement, ResultSets that were opened on that
statement will also be closed
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#close()

Also according to section 14.2.5 of the JDBC 3.0 spec:
"A ResultSet object is automatically closed when the
Statement object that
produced it is closed."

So this warning is needless and creates a lot of
needless log output:
2004.07.13 08:54:08.734 EDT WARN  [WrappedConnection]
Closing a result set you left open! Please close it
yourself.

We have <track-statements> turned on because we want to
be sure that we don't have unclosed statements.




----------------------------------------------------------------------

>Comment By: Adrian Brock (ejort)
Date: 2004-07-13 19:37

Message:
Logged In: YES 
user_id=9459

You are misunderstanding the nature of the warning.

The statement you get is not the real db statement, it is a
wrapper.

With statement caching (a statement is left open to be
reused by another
query), the statement will not be physically closed,
which means the automatic close of result sets will not happen.
This is why it is warning you about not closing ResultSets.

If you don't have statement caching enabled, the warning is
moot,
the result set will actually be closed. But your code won't work
when statement caching is enabled.

In fact with some older (but fairly recent) versions of
Oracle, there were
bugs if you didn't explicity close result sets.
There are other benefits related to transactions where closing
results sets early improves performance.

The change I have made is to reproduce the automatic
close connection -> closes statements
close statement -> closes resultsets
that will still work with statement caching using
<track-statements>nowarn</track-statements>
but making JBoss do this book-keeping will always be slower
than you doing it yourself with
<track-statements>false</track-statements>

Please take any further discussion to the forums.
Only reopen this bug report if the code I committed for
jboss-3.2.6
does not work.

----------------------------------------------------------------------

Comment By: David Boon (davidmboon)
Date: 2004-07-13 18:02

Message:
Logged In: YES 
user_id=1045592

I am setting the status of this 'open' since we still need
to be able to see when statements are not being closed
independent of resultsets.  I think you have a bug in that
when you close a statement, all resources opened from that
statment should be closed, we are closing our statments and
hence the resultsets, so why the warning?

----------------------------------------------------------------------

Comment By: David Boon (davidmboon)
Date: 2004-07-13 17:56

Message:
Logged In: YES 
user_id=1045592

Just to add a little more clarity, we have wrapped the
java.sql.Statement and explicitly close resultsets, we're a
bit confused as to why we're seeing the warning...we think
we're closing all resultsets


----------------------------------------------------------------------

Comment By: Adrian Brock (ejort)
Date: 2004-07-13 15:41

Message:
Logged In: YES 
user_id=9459

On the contrary. If you use Statement pooling the statement
is not
physically closed.

Since this is a frequently asked for feature, I have added
it for 3.2.6:
http://www.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources

<track-statements>nowarn</track-statements>
and made it the default setting, just to avoid the FAQ.

But you will probably find it does not perform as well as
<track-statements>false</track-statements>
and you closing them manually,
and also find, you have to do it anyway to
get code portable to other appservers.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=990142&group_id=22866


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to