Subject Re: [Firebird-Java] How to get column names as first row? (or why I would need ResultSet.first() and ResultSet.previous())
Author Mark Rotteveel
On 18-8-2010 23:10, Yves Glodt wrote:
> Hi,
>
> I have a case where I iterate over a resultset, and I want to print out the
> column names as first row.
>
> All this should be fast, so I do not want to call
> PreparedStatement.executeQuery twice.
>
> So I was thinking to call resultset.next once, iterate of the columns to get
> the names, then "rewind" the resultset, and iterate over it completely to
> get the actual data.
> Unfortunately this does not work since the calls ResultSet.first() and
> ResultSet.previous() are "not yet implemented"
>
> Anyone got another idea how I can do what I need to do? Btw this is using
> jaybird 2.1.6 on firebird 1.5.

Use the resultset metadata (getMetaData()) and retrieve the columnnames
from the returned ResultSetMetaData object.

Mark

--
Mark Rotteveel