The method getColumns()
on the metadata is returning an empty ResultSet for Synonyms (for tables and views it\'s returning the list of columns properly).
use this way
PreparedStatement pt=coneection.preparestatement("select * from table_name");
Resultset rs=pt.executeQuery();
ResultsetMetaData rsmd=rs.getMetaData();
System.out.println(rsmd.getColumnName(coulmn_number));
System.out.println(rsmd.getColumnType(column_number));
Another way
PreparedStatement pt=coneection.preparestatement("select * from table_name");
Resultset rs=pt.executeQuery();
ResultsetMetaData rsmd=pt.getMetaData();
System.out.println(rsmd.getColumnName(coulmn_number));
System.out.println(rsmd.getColumnType(column_number));