piou
asked on
JDBC: how to read CHAR and DATE data
What is the best way to read Oracle's CHAR data? I don't think there is a relevant ResultSet method... Would it be a getString? (If so, is it guaranteed that the string is of length==1?)
Also, when getting a java.sql.Date value, how can I put it in a java.util.Date?
Also, when getting a java.sql.Date value, how can I put it in a java.util.Date?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
s = s.substring(0, 1);
;-)
;-)
or if you just want the "char" value:
char c = s.charAt(0);
char c = s.charAt(0);
>>s = s.substring(0, 1);
Yes - not woken up properly yet ;-)
Yes - not woken up properly yet ;-)
Same thing I did with JList.add() last night ;-)
Not that it would have done you much good if you *had* got it right - for obvious reasons ;-)
ASKER
My worry about CHAR is implications when reading/writing using international locales. Anyway, by trial and error I guess :) Thanks.
8-)
It's the field in the db you should be concerned about, not Java. You should be able to store stuff in the db as Unicode. Java will handle it thereafter.
It's the field in the db you should be concerned about, not Java. You should be able to store stuff in the db as Unicode. Java will handle it thereafter.
s = s.substring(0);