aspose file tools*
The moose likes JDBC and the fly likes retrieve enumeration datatype into jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "retrieve enumeration datatype into jsp" Watch "retrieve enumeration datatype into jsp" New topic
Author

retrieve enumeration datatype into jsp

priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
Hi firends,

I am using MYSQL In my table i have enumeration data feild.I want to retrieve that data field into jsp page recordset.---- ?

can you please help me
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What do you mean by an enumeration data field?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
enum
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Ah, an enum data type?

This data type in MySQL is just character data; have you tried calling ResultSet.getString()?
priya pratheepp
Ranch Hand

Joined: Apr 02, 2008
Posts: 59
thanks...using getString i can retrieve only one value....

any other data types can do the same task?

for example data values are SG10,SG20,HK10,CN10 like that...each variable can have more than one value..example branch may have SG10,HK20 etc...Any suggestion to handle this situation?

thank you once again
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The documentation for the enum data type includes ways to do this. All PHP, but the logic will be the same in Java.

Personally, I would use a seperate table to store the enumerated values and a foreign key to refer to them and just not bother with the enum data type. I can't see how it is useful without being able to get the values easily in a non-database specific way (that way you don't have to change your Java code if you start using a differernt database).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: retrieve enumeration datatype into jsp