Column name

Hello,I have such a result setResultSet rset = stmt.executeQuery("select * from table");and I want to get the names of the colums, is it possible to do and how?
[213 byte] By [ramazas1a] at [2007-9-27 11:20:49]
# 1

Hi,

With ResultSet its not possible.

U have to use ResultSetMetaData.

The procedure for this is

ResultSetMetaData rsmd = rs.getMetaData();

int count = rsmd.getColumnCount();

Vector colNames = new Vector();

for(i=0;i<count;i++)

{

colNames.addElement(rsmd.getColumnName());

}

Hope this helps U.

With Warm Regards

Seshagiri>

shesh91a at 2007-7-9 5:58:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
Thanks, it works fine!
ramazas1a at 2007-7-9 5:58:18 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...