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


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "rs.getString question" Watch "rs.getString question" New topic
Author

rs.getString question

tom walters
Ranch Hand

Joined: Feb 14, 2002
Posts: 34
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

Joined: Apr 23, 2002
Posts: 168
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

Joined: Feb 14, 2002
Posts: 34
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
 
subject: rs.getString question