Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

String to decimal?

 
smitha verghese
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am using Access database and i retrieve the contents which is in "string" from the Excel sheet using ExcelApi and put into the database Production with field "decimal" type !
like this
'"+Double.valueOf(rs.getString("LINE_COUNT")).doubleValue()+"','"+Double.valueOf(rs.getString("QUALITY")).doubleValue()+"'
But i get an error
java.lang.NullPointerException
at java.lang.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:9
90)
at java.lang.Double.valueOf(Double.java:172)
at _0002fLineCount_0002ejspLineCount_jsp_100._jspService(_0002fLineCount
_0002ejspLineCount_jsp_100.java:194)
 
Amol Desai
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
One of the getString() is returning null.
Better way would be to create a StringBuffer and append each rs.getString() to it.
You could then find which method returns null.
-Amol
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why don't you just do
'"+rs.getString("LINE_COUNT")+"','"+rs.getString("QUALITY")+"'
 
David Weitzman
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since this isn't a performance question, I'm moving it to...um...Java in General (intermediate).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic