Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes JDBC and Relational Databases and the fly likes Retrieve MySQL table column names Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Retrieve MySQL table column names" Watch "Retrieve MySQL table column names" New topic
Author

Retrieve MySQL table column names

Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
How can I get the column names from a MySQL table?


Bryan Scarbrough<br /> <br />Consistency is the last resort of the unimaginative!
Padma Lalwani
Ranch Hand

Joined: Nov 02, 2004
Posts: 49
Run the query as select *, get ResultSetMetaData from the ResultSet, use getColumnCount to get number of columns and then loop through to get name using getColumnName

Padma
Bryan Scarbrough
Ranch Hand

Joined: Aug 08, 2005
Posts: 49
Thanks, that was easier than I thought it would be!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retrieve MySQL table column names