SilverStray
Programmer
Hi,
The JAVA API states that getColumnLabel() function of object ResultMetaData can be used to use the display label of the SQL resultset, while the getColumnName() function is used to get the column name as specified in the table.
I used getColumnName() to get the exact column name as defined in the table, but it doesn't seem to work. It picks up the label name just like the value picked up by getColumnLabel().
PreparedStatement ps = conn.prepareStatement(sqlStmt);
ResultSet rs = null;
rs = ps.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 1; i <= numberOfColumns; i++) {
System.out.println(rsmd.getColumnName(i));
}
Please help! Thanks!
The JAVA API states that getColumnLabel() function of object ResultMetaData can be used to use the display label of the SQL resultset, while the getColumnName() function is used to get the column name as specified in the table.
I used getColumnName() to get the exact column name as defined in the table, but it doesn't seem to work. It picks up the label name just like the value picked up by getColumnLabel().
PreparedStatement ps = conn.prepareStatement(sqlStmt);
ResultSet rs = null;
rs = ps.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 1; i <= numberOfColumns; i++) {
System.out.println(rsmd.getColumnName(i));
}
Please help! Thanks!