File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ArrayList" Watch "ArrayList" New topic
Author

ArrayList

MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
I'm having problem adding an integer value which is returned from a resultSet object,using getInt.How do this?
ie.

result -> ResultSet Object
list -> ArrayList Object

list.add(..??..result.getInt("someint"))


God Gave Me Nothing I Wanted<br />He Gave Me Everything I Needed<br /> - Swami Vivekananda
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Moving this to the JDBC forum...


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61422
    
  67

You cannot add a primitive type (in this case int) to a List.
[ July 22, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
MInu
Ranch Hand

Joined: Oct 09, 2003
Posts: 517
so you mean to say that i'll have to convert it to something like string and then add to the arraylist?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61422
    
  67

More like an Integer.
Gagan Gulati
Greenhorn

Joined: Jul 27, 2004
Posts: 7
Just do a list.add(new Integer(result.getInt("someint")))
This shud work ..

Lists take only composite types
Abacus White
Greenhorn

Joined: Jul 23, 2004
Posts: 8
[Nonsense content removed. If you do not have anything meaningful to say. Please refrain from posting. Thanks.]
[ July 28, 2004: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61422
    
  67

"Abacus White",

We're pleased to have you here with us on the Ranch, but there are a few rules that need to be followed, and one is that proper names are required. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
Forum Bartender
 
Don't get me started about those stupid light bulbs.
 
subject: ArrayList