Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2004

Tip: Looking for answers? Try searching our database.

j2sdk1.4.2_03 getXXX() methods in ResultSet

Thread view: 
_chasers - 16 Jan 2004 18:49 GMT
I don't remember it being like this when using ResultSets in the past,
but when using j2sdk1.4.2_03 on Windows NT, it seems that I can only
call a rs.getXXX() method once per iteration. For example, if I do:

while (rs.next()) {
 String s = rs.getString("Field1");
 if (s != null && s.length() > 0)
   System.out.println(s);
}

then everything works okay. But if I do:

while (rs.next()) {
 if (rs.getString("Field1") != null &&
((String)rs.getString("Field1")).length() > 0 )
   System.out.println(rs.getString("Field1"));

then it either returns an empty ResultSet or only 1 row before
throwing an exception. Did anyone else run into this problem?

Thanks
kaeli - 16 Jan 2004 19:38 GMT
> I don't remember it being like this when using ResultSets in the past,
> but when using j2sdk1.4.2_03 on Windows NT, it seems that I can only
> call a rs.getXXX() method once per iteration. For example, if I do:

The specs/docs specifically state that you should NOT call getXXX more
than once per iteration. Don't. Put it in a variable then do what you
need to do with it. Less overhead, too.

Signature

--
~kaeli~
A midget fortune teller who escapes from prison is a small
medium at large.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.