aspose file tools
The moose likes JDBC and the fly likes ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply 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: 56529
    
  14

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

[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About 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: 56529
    
  14

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: 56529
    
  14

"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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: ArrayList
 
Similar Threads
Need help in transfering data from JDBC layer to Presentation Layer [JSP]
Result set / Arraylist
need java logic
jsf data table
Need help with dinamic variable names