This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes The conversion of the varchar value '5438954444' overflowed an int column. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "The conversion of the varchar value Watch "The conversion of the varchar value New topic

The conversion of the varchar value '5438954444' overflowed an int column.

veda Cherak

Joined: Aug 16, 2011
Posts: 13
I am getting the above exception. Please help.
I populated my column(Sys_number) with 10 rows and each with 10 digits.
When I enter any value less than 10 digits I get this exception.

Name : Sys_Number
Datatype : varchar(50)

Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3739

Can you post the exception? Also, it's better to used PreparedStatements for input parameter than Statements.

[OCA 8 Book] [Blog]
chris webster

Joined: Mar 01, 2009
Posts: 1996

The error message seems plausible, because 5,438,954,444 would be too big a value for an int variable. As I understand it, an int can hold values between -2,147,483,648 and 2,147,483,647. So the question is what is really in your table - is this big value really in there, or is it created accidentally in your Java code? If the value is correct, then maybe you need to use a long variable in Java instead.

Why don't you run your SQL separately in your database's SQL interface, so you can check what's really in your table? Then you'll know whether the problem is data or code.

No more Blub for me, thank you, Vicar.
It is sorta covered in the JavaRanch Style Guide.
subject: The conversion of the varchar value '5438954444' overflowed an int column.