Hello,
I was just playing around with the 04/19 version of the JDBC tag
library and trying to run the example pages. I am using Oracle as a
back-end database and using a JNDI named datasource under Resin 1.2.3.
I am getting the following exception while running the jndijdbc.jsp
page:
javax.servlet.jsp.JspTagException: Could not find column named id
at
org.apache.taglibs.jdbc.resultset.BaseGetterTag.getColumnNumber(BaseGetterTag.java:245)
at
org.apache.taglibs.jdbc.resultset.BaseGetterTag.getPosition(BaseGetterTag.java:111)
at
org.apache.taglibs.jdbc.resultset.GetNumberTag.doStartTag(GetNumberTag.java:149)
I tracked down the problem to this line in the JSP:
<td><sql:getNumber colName="id" format="CURRENCY" locale="en_GB"/></td>
Now, it turns out that if I use all caps for the column name like "ID"
rather than "id" it works. I think this is due to the fact that I am
running Oracle and it is probably passing back the column names in all
caps regardless of how the table was created. However, colName should
probably be doing a case insensitive compare. I narrowed it down to
this bit of code in BaseGetterTag.java:
236 for (int i = 1; i <= cntColumn; i++) {
237 if (strName.equals (meta.getColumnName (i))) {
238 return i;
239 }
240 }
Changing line 237 to use String.equalsIgnoreCase() should fix it. SQL
is not case sensitive, right?
-Dave