Subject Re: [Firebird-Java] Columns names in resultset
Author Roman Rokytskyy
> when I do rst.getString("C.NAME") it does not work, and the exception
> says that the columns name was not found in the result set.
> Doing rst.getString("NAME") works.
>
> Is this normal and expected?

As Steffen wrote - yes.

> This behaviour gives me trouble since I have a query where I do several
> left-joins on the same table, with different aliases, and I do not see
> how I can differentiate the colum names.

Even more, the specification requires to match the first column by the
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