File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
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