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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
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: 14687
    
  16

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: 14687
    
  16

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: 41793
    
  62
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.


Ping & DNS - my free Android networking tools app
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Why doesn't it work with long ? Please show me your code.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.NumberFormatException: For input string: "12122009100"