java - JDBC callableStatement.setDouble() getting 'Infinity' is not a valid numeric or approximate numeric value -


i have researched online last hour can't figure solution problem.

so, have

for (balancebreakdownfee breakdownfee : tuitionfee.getbalancebreakdownfees()) {     system.out.println("balance breakdown fee description : "+breakdownfee.getdescription());     system.out.println("balance breakdown fee amount : "+breakdownfee.getamount());     cs_addbalbreakdownfee.setstring(1, breakdownfee.getdescription());     cs_addbalbreakdownfee.setdouble(2, breakdownfee.getamount());     cs_addbalbreakdownfee.registeroutparameter(3, types.integer);     cs_addbalbreakdownfee.executeupdate();      int balancebreakdownfeeid = cs_addbalbreakdownfee.getint(3); } 

prior executing for each loop above, have tried print value of breakdownfee.getamount() returns double value. here's output.

description :downpayment amount : 8000.0 description :first quarter amount : 2663.28 description :second quarter amount : 2663.28 

for reason, when make call cs_addbalbreakdownfee.setdouble(2, breakdownfee.getamount()); error points setdouble() line.

java.sql.sqlexception: 'infinity' not valid numeric or approximate numeric value     @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:959)     @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:898)     @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:887)     @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:862)     @ com.mysql.jdbc.preparedstatement.setdouble(preparedstatement.java:3252) 

as can see, tried printing breakdownfee.getamount() within for-each loop see value gets compare previous print above.

and this,

balance breakdown fee description : downpayment balance breakdown fee amount : 8000.0 balance breakdown fee description : first quarter balance breakdown fee amount : infinity 

i don't understand why won't accept 2663.28 double value. appears jdbc reading 'infinity'

also, add more details, mysql column stores amount set decimal(10,2)

any thoughts or suggestion on how can store 2663.28 value? problem 2 decimal places? if so, how can fix this?

thank you.

your problem isn't jdbc @ point. problem how you're getting list of fees.

system.out.println("balance breakdown fee amount : "+breakdownfee.getamount()); 

has nothing jdbc, , yet, giving java reserved value of infinity. need investigate happening amount between time checked before loop, , when check in loop.

however, when solve that, might still have problem of java reserved values of infinity , nan (not number). in cases possible, people check , insert null instead of value. semantics of application may differ.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -