How to get column names of a table using ResultSetMetaData?
This example show how we can use the ResultSetMetadata class to get the number of columns and column names of the selected table. The ResultSetMetaData class can also be used to get the column type and its properties.
Using this class might help you to create an inquiry program where you don't have all information about table columns.
Some result generated by our above examples are:
id = 1
username = admin
password = secret
first_name = john
last_name = doe
created = 2007-12-18 10:52:55.0
create_by = system
modified = 2007-12-18 10:52:55.0