You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Lavandowska <fl...@yahoo.com> on 2001/07/29 21:38:54 UTC

Problem with DBTags

No, not the "where's the tld" problem.

I'm trying to execute two queries on the same connection.
The first query is a simple "select name from table where ..."
that only returns one column and one row.  The second query returns
several columns for several rows.  The problem is that my driver
returns 
javax.servlet.jsp.JspTagException: java.sql.SQLException: [TDS
Driver]Invalid column number (2). A number between 1 and 1 is valid.
	at org.apache.taglibs.dbtags.resultset.GetColumnTag.doStartTag

It looks like something isn't getting reset in GetColumnTag.doStartTag
for the second query?  Perhaps it isn't creating a new ResultSet?  Or
could this be an error in how OrionServer caches tags?

I've tried putting them in the same <statement> tag, and in seperate
<statement> tags, doesn't seem to matter.  Either query on its own runs
fine, it is only when I attempt to do both that I get this problem.
Example psuedo-code follows:

<sql:statement id="stmt1" conn="conn1">
    <sql:query>
	select name from table where id = <%= tableId %>
    </sql:query>
	
    <sql:resultSet id="rset1">
	<sql:getColumn position="1"/>
    </sql:resultSet>
	
   <sql:query>
     select id, name, foo, bar
     from table2
     where table1_id = <%= tableId %>
     order by sort_order
   </sql:query>
   
   <%-- loop through the rows of your query --%>
   <table border="1">
   <sql:resultSet id="rset2">
       <tr><td>
   	 <b>Name:</b> <sql:getColumn position="2"/><br>
   	 <b>Foo:</b> <sql:getColumn position="3"/><br>
   	 <b>Bar:</b> $<sql:getColumn position="4"/>
       </td></tr>
   </sql:resultSet>
   </table>
   
</sql:statement>

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/