Given the name of a table, how to know the names of the columns using JDBC? I know it's something using DatabaseMetaData, examples are welcome!
Completing question:
I'm using HSQLDB and creating the table when I start the server and it seems that databasemetada is failing to read the column names.
String tableName = "cities";
DatabaseMetaData metaData = connection.getMetaData();
ResultSet resultSet = metaData.getColumns(null, null, tableName, null);
while(resultSet.next()){
System.out.println(resultSet.getString("COLUMN_NAME"));
}
The object resultSet.next() is coming empty.