the source code below is the method that i use to retrieve the data from the database...i have success retrieve the data but the value i get is no the value in database but just [Ljava.lang.object;@1855af5. actually the value in my database is JCX1234. how to solve this problem.how to change it to a string value. can anyone help me. 10s.....
Anthony, If the data-type of column BUS_NO is not [VAR]CHAR, then you cannot use the "getString()" method to retrieve it (from the "ResultSet"). Since you are already using the "ResultSetMetaData" interface (in your code), perhaps you can use the relevant methods to determine the data-type of BUS_NO, and then use the appropriate "getXXX()" method to retrieve it. I suggest looking at these methods:
Good Luck, Avi.
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
data is an Object[]. You can not just printout an array and see the content.
- i would make data a String[] (since you retrieve Strings from the ResultSet) - then print out data[i] in a loop and you should see the correct values.
pascal
pascal betz
Ranch Hand
Joined: Jun 19, 2001
Posts: 547
posted
0
actualy i would make the data a List because then you do not need to fetcch the col count from the metadata.
and dont forget to close the Statement/ResultSet/PreparedStatement/Connection (in the finally clause).
pascal
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.