This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JDBC and the fly likes ResultSet's getXXX methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ResultSet Watch "ResultSet New topic
Author

ResultSet's getXXX methods

eric moon
Ranch Hand

Joined: Nov 26, 2000
Posts: 133
Given that a result set knows the TYPE of each column of data, via ResultSetMetaData I'm wondering whether it's impossible or impractical to extend ResultSet and provide a get() method that is TYPE independent, and calls the appropriate getXXX based on the column's type (at least for those types that should be displayed as text.) If it is possible, what are the reasons for not supplying something like this in java.sql?? I'm tempted to try doing this, and am wondering if there is some huge pitfall I've overlooked!
[I just looked at ResultSet.getString() again and it sounds like maybe it already does this. I will try it and see.]
Thanks!
[This message has been edited by eric moon (edited December 16, 2000).]


<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>"Those who cast the votes decide nothing. Those who count the<BR>votes decide<BR>everything." <BR> -Joseph Stalin<HR></BLOCKQUOTE>
paul sun
Greenhorn

Joined: Dec 22, 2000
Posts: 28
getObject() can do whatever type you want. Isn't it "independent"?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ResultSet's getXXX methods