Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

rs.getString question

 
tom walters
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
data is:
+55-19-3737-4102
and it is stored in oracle as a varchar2(250)
when i pull it out with rs.getString(1) i get -7803 (the result of the math operation) instead of +55-19-3737-4102. i always thought getString() doesn't do any conversions, what is going on?
when i view the data in toad, it is +55-19-3737-4102.
 
Michael Zalewski
Ranch Hand
Posts: 168
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by tom walters:
data is:
+55-19-3737-4102
and it is stored in oracle as a varchar2(250)
when i pull it out with rs.getString(1) i get -7803 (the result of the math operation) instead of +55-19-3737-4102. i always thought getString() doesn't do any conversions, what is going on?
when i view the data in toad, it is +55-19-3737-4102.

If you do

you get exactly this result. Not because it got converted in getString(). Because it got converted on insert.
If you do

you will get the string out.
(You are using PreparedStatement to update the database right? If not, you probably should). If you used Statement.execute( String), you probably forgot to put quotes around the +55-19-3737-4102.
 
tom walters
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it turned out to be a data loading issue, exactly what i am not sure (another team manages the data). the java code was fine and it works now w/ out any changes.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic