Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySQL ENUM and JDBC

 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I retrieve all of the values of a MySQL ENUM datatype with a JDBC query? I want to take those values and make an HTML drop down list.

I already have a script to create the list from a MySQL query, I just want to know how to retrieve all of the ENUM values with at query.

Thanks,
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bryan,
You can just call rs.getString() to get the value of the enumeration. Enum is more for MySQL to only allow you to set the column to valid states. After that, it is stored as a regular value.
 
Bryan Scarbrough
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I thought about that one as well, but it does not help if some values have never been chosen, so I just wound up hard coding the values into a list. Thanks anyway.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic