hi there!
I'm new to jdbc programming, and I can't find an answer for my problem.
Take for example this bunch of code:
protected void executeQuery( Connection con, String sqlStatement )
throws Exception {
try {
Statement s = con.createStatement ( );
ResultSet rs = s.executeQuery( sqlStatement );
while ( rs.next ( ) ) {
String id = ( rs.getObject ("id").toString() );
String text = ( rs.getObject ("text").toString() );
System.out.println ( "found record : " + id + " " + text );
}
rs.close ( );
} catch ( SQLException e ) {
System.out.println ( "Error executing sql statement" );
throw ( e );
}
}
well, in this query, it retrives the attributes "id" and "text" from the
result set. That's ok. But, how could I retrive _all_ the attributes in
a particular ResultSet without know them before?
For instance, my executeQuery method should be perform query like:
SELECT NAME, SURNAME
FROM TABLE1
WHERE etc...
or
SELECT *
FROM TABLE1
WHERe ...
can you help me?
thanks!

Signature
Shya
John Currier - 23 Jul 2005 22:00 GMT
The ResultSetMetaData returned by rs.getMetaData() will give you the
details you're looking for. You'll also want to close your ResultSet
and Statement in a finally block.
John Currier
http://schemaspy.sourceforge.net