aspose file tools
The moose likes JDBC and the fly likes java.lang.NumberFormatException: For input string: Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "java.lang.NumberFormatException: For input string: "12122009100"" Watch "java.lang.NumberFormatException: For input string: "12122009100"" New topic
Author

java.lang.NumberFormatException: For input string: "12122009100"

Nagaraju Pee
Greenhorn

Joined: Feb 13, 2010
Posts: 5
Hi,
I want ti insert a number 12122009100 into a table called EMPDATA which has a column emp_val number(16,0) with preparedstatement.

Here i'm using getters and setters.




The main class code snippet is as follows....



while executing the above class i'm getting NumberFormatException.
could anybody please assist me why i'm getting this exception

thanks







Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Use a long instead of an int.


[My Blog]
All roads lead to JavaRanch
Nagaraju Pee
Greenhorn

Joined: Feb 13, 2010
Posts: 5
Still i'm getting the same exception even though i changed it to long
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Please show me your code.
Nagaraju Pee
Greenhorn

Joined: Feb 13, 2010
Posts: 5
The exception got resolved by replacing Integer.parseInt() with Double.parseDouble()
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35220
    
    7
The exception may be resolved, but are you certain it's doing the right thing? If it's not possible to pass a parameter to a "setInt" method using the result of parsing in integer, then maybe it actually isn't an integer? In which case passing a Double would just mask the problem. Make sure the DB data type can handle all values that Double.parseDouble returns for all input values that may get passed into it.


Android appsImageJ pluginsJava web charts
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14669
    
  11

Why doesn't it work with long ? Please show me your code.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: java.lang.NumberFormatException: For input string: "12122009100"
 
Similar Threads
Servlet-JDBC
Searching problem
How to Pass arguements in errors.rejectValue()
How to insert/Retrieve object as Blob to/from database table?
doubts in setDate(i,date,cal) API of preparedStatement