This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "The conversion of the varchar value Watch "The conversion of the varchar value New topic
Author

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

veda Cherak
Greenhorn

Joined: Aug 16, 2011
Posts: 13
Hi,
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: 3703
    
    5

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


My Blog: Down Home Country Coding with Scott Selikoff
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1624
    
  13

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.
 
Similar Threads
Mapping to an xml typed column (PostgreSQL) on an EJB3 entity in JBoss 5.1
Problem with รจ character in Java.
Generating & Recognizing keys in java
using init-param to set a value in a table
String, read and write file problem...