Subject | Re: [Firebird-Java] Columns names in resultset |
---|---|
Author | Roman Rokytskyy |
Post date | 2008-08-10T20:15:01Z |
> when I do rst.getString("C.NAME") it does not work, and the exceptionAs Steffen wrote - yes.
> says that the columns name was not found in the result set.
> Doing rst.getString("NAME") works.
>
> Is this normal and expected?
> This behaviour gives me trouble since I have a query where I do severalEven more, the specification requires to match the first column by the
> left-joins on the same table, with different aliases, and I do not see
> how I can differentiate the colum names.
name. So you even don't have guarantee which column will be returned and
how to access other columns. So assign aliases to the columns.
In general it is always safe to access the columns via their indexes. In
your case you can use ResultSetMetaData information to get the name of
the column and the table of the column (but not the table alias, in your
case "C") for the specified index. This won't work if you use the same
table more than once in your SQL.
Roman