ResultSetMetaData in JDBC example

The object of java.sql.ResultSetMetaData can be used to get the details of the columns available in the ResultSet object.

Some of the important methods of ResultSetMetaData are

Lets see ResultSetMetaData in JDBC example using some of the above methods

ResultSetMetaData in JDBC example

Details of the Database table

Now we will write a sample code that will get the details of each of the columns using ResultSetMetaData
Please Note : Column number starts from 1. So when you use getColumnName(int column) or any other method, the parameter should start from 1 (and not 0). See the for loop in the sample code starts with int i = 1



1. ResultSetMetaData API