Subject AW: [Firebird-Java] Columns names in resultset
Author Steffen Heil
Hi

> see this example:
> select C.NAME from CUSTOMER C
> 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?

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.

I don't know how, but firebird is propably renaming the conflicting columns.
However to be one the safe side, I always use "as":

select c.name as c_name, d.name as d_name from tablec c, table d d where
c.id=d.id

rs.getString( "c_name" );
rs.getString( "d_name" );

This works for every database server and does not rely on renaming conventions
of particular servers.

Regardsm
Steffen



[Non-text portions of this message have been removed]