This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JDBC and the fly likes How to get the table column names Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to get the table column names
 
Similar Threads
Retrieve MySQL table column names
problem simply stated
Autoresizing table column
Getting column names from the table name
DatabaseMetaData.....