| Author |
Not Quite sure how there is a SQLException on this line...
|
Michael Paul
Greenhorn
Joined: Mar 29, 2008
Posts: 14
|
|
Hi, I am trying to just get the value of a column in a DB that stores an int. The value is not null. I have tried both using a column name and index number and with both I get a SQLException error. This is the code: The line I am getting the error on is: Anyone have an idea as to why this would be happening? All help would be appreciated.
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
Michael, JDBC requires you call rs.next() before rs.getXXX(). A typical idiom is:
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26499
|
|
|
Note that we have a forum just for JDBC questions up near the top of the forum list. I'll move this for you.
|
 |
Michael Paul
Greenhorn
Joined: Mar 29, 2008
Posts: 14
|
|
Thank you very much, sometimes I shock myself with how I overlook small things! I new that you had to do rs.next() and for some reason refused to think of that...Thank you very much for your help! Michael
|
 |
 |
|
|
subject: Not Quite sure how there is a SQLException on this line...
|
|
|