无法从结果集中的元数据中获取表名

时间:2015-09-25 14:58:41

标签: java metadata resultset

运行执行某些sql语句后,我从结果集中获取了一些元数据。我想从元数据中获取表名。我正在使用

Metadata.getTableName(1);

但它什么也没有回归;那是什么意思?另请注意,我能够成功地从元数据中获取列名,而不是表名。

1 个答案:

答案 0 :(得分:1)

你必须使用DatabaseMetaData md = connection.getMetaData();

来自javadoc which retrieves a DatabaseMetaData object that contains metadata about the database to which this Connection object represents a connection. The metadata includes information about the database's tables, its supported SQL grammar, its stored procedures, the capabilities of this connection, and so on.