aspose file tools*
The moose likes JDBC and the fly likes getting NumberFormatException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "getting NumberFormatException" Watch "getting NumberFormatException" New topic
Author

getting NumberFormatException

toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
hi friends,

i am getting this error while inserting the record...




the error is like...

java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source)
java.lang.Integer.parseInt(Unknown Source)
dailycollection.DailyCollectionEntry.processRequest(DailyCollectionEntry.java:75)
dailycollection.DailyCollectionEntry.doPost(DailyCollectionEntry.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


no null value is being inserted....

using JDK 1.5....

i m using the insert statement at one more place and it is working very well....


please help me
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
the values coming to the server from the client browser will be of type string..

Any int values that you are passing to the statement and which comes from the client ...has to be changed from string to int....

check in your code whether such a conversion is taking place...and what columns in the table are of type numeric...
toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
yes there are two numeric columns in the table....

but i want to know why is it working at other place?
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Can you post the code...and what are the columns that are numeric and for what values are they causing the exception...??
toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
for the first time i am using the following code....





here the amountCash,amountCheque, amountDeposited are the numeric fields...still it is working....

For the second instance when i am trying to insert the record it is showing the following exception...




and the error msg is like the above given....

note that the statement.....

insert into tbl_daily_collection (collection_date,user_code,circle,amountCash,amountDeposited,DATE_OF_DEPOSITION,BANK_NAME) values (to_date('12/12/06','dd/mm/yyyy'),'wmsec','530','450','450',to_date('12/12/06','dd/mm/yyyy'),'bom');

is also working fine at SQL prompt...

what can be the reason...
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Go to Line no. 75 of DailyCollectionEntry.java

Furthermore, check out Beware-of-Auto-boxing and Auto-unboxing.
[ February 13, 2007: Message edited by: Adeel Ansari ]
toukhir mujawar
Ranch Hand

Joined: Oct 11, 2006
Posts: 70
thanks friends i got the solution...i had made a silly mistake...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting NumberFormatException
 
Similar Threads
Element type "chartLegend" must be declared
Date format
Invalid Oracle URL specified
storing date in mysql
Inserting the Date in to MySQL