Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve MySQL table column names

 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I get the column names from a MySQL table?
 
Padma Lalwani
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that was easier than I thought it would be!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic