In ResultSet.getXXX(String columnName), the columnName parameter
represents the column Label which defaults to the column name if a label
is not specified in the query.
You can get your query to work by using an alias
select f.col1 as col1, f.col2 as col2 from ftab f
ResultSet.getXXX("col1");
Column references, which would be <table>.<column>, is what your example
is using and JDBC supports access via the Column Label (or its default
columnName if not defined).
Regards
Lance
Diego Zanga wrote:
> 2007/2/15, Stanley Bradbury <Stan.Bradbury@gmail.com>:
>> Diego Zanga wrote:
>> > hi!
>> >
>> > I've seen there is some problem to use a syntax like
>> > resultset.getString( "TABLENAME.FIELDNAME" )
>> > 'cause it works only with
>> > resultset.getString( "FIELDNAME" )
>> > ( with every getXXXX method, even getColumn)
>> > is there a workaround to allow table.field syntax
>> > to identify columns?
>
>> The Java API doc lists columnName or columnIndex as the parameters to
>> use with ResultSet.getString. Do you know if the JDBC specification
>
> yep, however near all the database implements as columnName
> the single <columnName> or <table.column>: reading the derby
> sql syntax i tought even this db has this syntax
> http://db.apache.org/derby/docs/10.1/ref/
> -> it works in a select, it doesn't while getting the field value
>
>
>> states that columnName references support TABLENAME.COLUMNNAME
>> syntax? If so then please file a bug in JIRA to get this corrected.
> i'm going to check it :O) when i found where's the references
> documents :OP
> (i've no idea, but hope to find 'em with google)
> however can tell me where (address) i could then file it in JIRA?
> (i've never submitted a bug, if it's a bug)
>
>
> cya, Thanks :-)
|