wood burning stoves*
The moose likes JDBC and the fly likes How to get the table column names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to get the table column names" Watch "How to get the table column names" New topic
Author

How to get the table column names

Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
How to get table column name using ResultsetMetadata if there is no record present in the table.Thanks


Thanks,
Mathews
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
I don't think having an empty resultset prevents you from accessing the ResultSetMetaData object. Have you tried it?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
You can get the column names from ResultSetMetaData even if your resultset is empty. For example if your quey is

Still you will be able to get column names from the corresponding ResultSetMetaData.

-Sainudheen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get the table column names