user2665166
user2665166

Reputation: 471

Trouble getting table name from meta data from result set

I have gotten some meta data from a result set after running executing some sql statement. I want to get the table name from the meta data. I am using

Metadata.getTableName(1);

But it is returning nothing; what does that mean? Also note that I am able to successfully grab column names from the meta data, just not the table name.

Upvotes: 0

Views: 212

Answers (1)

Shriram
Shriram

Reputation: 4411

you have to use DatabaseMetaData md = connection.getMetaData();

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

Upvotes: 1

Related Questions