Oliver Jowett wrote:
> Mike Martin wrote:
> > For programmatic purposes the column name concept is pretty
> > well defined by the docs on ResultSet.
>
> Can you point me to these docs? I can't see this requirement from a
> glance through the 1.4 javadoc, but the JDBC javadoc is pretty useless..
From the ResultSet Javadoc:
"The column name option is designed to be used when column
names are used in the SQL query that generated the result set.
For columns that are NOT explicitly named in the query, it
is best to use column numbers."
The only way to "name" a SQL query column is with AS. There's
corroboration in DatabaseMetaData:
public boolean supportsColumnAliasing() throws SQLException
Retrieves whether this database supports column aliasing.
If so, the SQL AS clause can be used to provide names for
computed columns or to provide alias names for columns as
required.
In both cases, "names" and not "labels".
I too wish the docs were more definitive on this. Googling on
the topic reveals that there has been confusion on it for some
time. Anyone know someone at Sun who could confirm the true
intent?
Mike