Bug 4877 - Empty result set prints query string
Summary: Empty result set prints query string
Status: RESOLVED DUPLICATE of bug 26863
Alias: None
Product: Taglibs
Classification: Unclassified
Component: DBTags Taglib (show other bugs)
Version: unspecified
Hardware: PC other
: P3 blocker with 15 votes (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2001-11-14 15:03 UTC by John R. Smith, Jr.
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description John R. Smith, Jr. 2001-11-14 15:03:14 UTC
With the following configuration, an empty result set prints the SQL query 
string: JSP server = JRun 3.1; Database = Access 2000; OS = XP Home.

However, with the following configuration, an empty result set (the same query) 
does not print the SQL query string: JSP server = Tomcat; Database = SQL Server 
7.0; OS = NT 4.0.

Can you tell me which is causing the problem?
Comment 1 John R. Smith, Jr. 2001-11-15 11:35:19 UTC
I have narrowed the problem to being the JRun server.  I will try to get an 
answer from them but in the meantime, can anybody help???
Comment 2 Morgan Delagrange 2002-04-15 02:19:45 UTC
This is probably some bug in the Taglib lifecycle for that version of JRun.  
Can someone who runs JRun debug this?
Comment 3 Caroline CLEP 2002-09-19 06:31:05 UTC
I have the same problem with tomcat 4.1.10, Win 2000 and MySQL 2.23.49.
It happens only if there is another query (not empty) on the jsp page. It 
doesn't happen if I set loop at false in the resulset tag. Any help ?? Thanks
Comment 4 Fernando Silva 2002-10-24 20:39:49 UTC
I have the same problem with Tomcat 4.1.12, solaris 2.8, Java 1.3.1_05 and 
Sybase Server 11.9.2.

Any help?
Comment 5 Yakov Shtrakhman 2002-10-28 18:35:58 UTC
I have the same problem with Tomcat 4.1.12, solaris 2.8, Java 1.3.1-b24 and 
Sybase Server 12.
Comment 6 Matthias Rambold 2002-11-01 10:12:42 UTC

I had the same problems as the others. Now, after changing a single line in the 
ResultSetTag-Class it works just fine for me.

What I changed:
the doEndTag()-Method contains the following if-statement (line 231):

if (getBodyContent() != null && getPreviousOut() != null) {

I just added another condition: _rowCount != 0
Now it looks like this:

if (getBodyContent() != null && getPreviousOut() != null && _rowCount != 0) {

With this condition-check the query-string doesn't appear anymore when a result-
set is empty. I hope, this does not affect other necessary behaviours of 

Furthermore I suggest to change the EVAL_BODY_TAG return-statements in all the 
dbtags-classes to either EVAL_BODY_BUFFERED or EVAL_BODY_AGAIN as EVAL_BODY_TAG 
is deprecated.

Greetings from Switzerland
Matthias Rambold
Comment 7 Alessandro Torrisi 2002-12-06 14:55:04 UTC
Hi! We have resolved this problem following Matthias Rambold's advices, but 
changing something...

In the ResultSetTag class we have changed from:

if (getBodyContent() != null && getPreviousOut() != null) {


if (_rowCount != 0) {

And changed in the following classes:

- ConnectionTag
- PreparedStatementImplTag
- ResultSetTag
- StatementImplTag

the attribute EVAL_BODY_TAG to EVAL_BODY_BUFFERED because the first is 

Everything in our application (HelpDesk On-Line) is going well !!!
Bye and best regards.
Comment 8 Mirko Seifert 2004-02-09 20:53:50 UTC
i tried all of the solutions proposed above and none worked for me. all of 
them cause trouble if one sets the loop attribute to "false". i figured out 
that a missing 


statement at the beginning of the release() method in ResultSetTag.java is the 
root of this bug.
Comment 9 Felipe Leme 2004-02-27 02:55:23 UTC
Mirko (and other),

This bug seems to the same problem fixed on bug 26863.

I committed the changes earlier today - could you test it tomorrow, with the
next nightly build?

Comment 10 Felipe Leme 2004-02-27 13:47:04 UTC

*** This bug has been marked as a duplicate of 26863 ***
Comment 11 Mirko Seifert 2004-03-01 15:12:09 UTC
I just ran a test using jakarta-taglibs-dbtags-20040301.zip and everything 
worked fine.