DatabaseMetaData.getColumns returning an empty ResultSet for synonyms

后端 未结 2 1920
野趣味
野趣味 2021-01-06 18:17

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).

<
2条回答
  •  逝去的感伤
    2021-01-06 18:35

    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));
    

提交回复
热议问题