Exception in thread "main" java.lang.NumberFormatException: For input string: "Mike"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at com.mysql.cj.protocol.a.MysqlTextValueDecoder.getDouble(MysqlTextValueDecoder.java:249)
at com.mysql.cj.result.AbstractNumericValueFactory.createFromBytes(AbstractNumericValueFactory.java:56)
at com.mysql.cj.protocol.a.MysqlTextValueDecoder.decodeByteArray(MysqlTextValueDecoder.java:143)
..
at com.mysql.cj.jdbc.result.ResultSetImpl.getInt(ResultSetImpl.java:830)
at Sample.main(Sample.java:22)
This Exception occurs when you are trying to iterate over the ResultSet Object and making use of the getInt() method instead of getString(), the column in the Database table is a String and not a Number!
Solution:Replace getInt() with getString()

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!