GeeCON Prague 2014*
The moose likes JDBC and the fly likes Mapping BigInteger java object into a ResultSet Data Type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Mapping BigInteger java object into a ResultSet Data Type" Watch "Mapping BigInteger java object into a ResultSet Data Type" New topic
Author

Mapping BigInteger java object into a ResultSet Data Type

Vikki Fiawoo
Greenhorn

Joined: Oct 22, 2010
Posts: 11
I have a simple question that has been driving me crazy for a few hours. I have researched all of over the web and cannot still seem to figure it out.

I have variable that I have set to a BigInteger. For example,



The this value is stored in the database as a tinyint.



I want to retrieve the data from the database using a resultset. I have tried several different datatypes and none of them are working. I am keep getting an error when I try to build my code. Here are some examples that I have tried to use:



I was also thinking that I need to explicitly convert the result set into a BigInteger.
Can someone please help with the mapping of my java BigInteger datatype and the correct sql datatype to use in my resultset. An example of this mapping would be extremely helpful


joy b chakravarty
Ranch Hand

Joined: May 16, 2011
Posts: 62

try user.setUserId(new BigInteger(Integer.valueOf(rs.getInt("User_Id")).toString()));


Cheers, Joy [SCJP 1.4, SCBCD 5.0]
get high on alcohol, algorithm or both
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Mapping BigInteger java object into a ResultSet Data Type