Oracle JDBC Returning Junk for CHAR and correct for numeric [message #126491] |
Tue, 05 July 2005 04:21 |
liladhar
Messages: 1 Registered: July 2005
|
Junior Member |
|
|
I am accessing data using JDBC from two oracle servers having oracle 9.2.0 and oracle 9.2.0.1.0.
I am getting correct data from oracle 9.2.0 db server while I try to access the data from oracle 9.2.0.1.0
I get following output.
[1, ???, ???]
[2, ???, ???]
[3, ???, ???]
[4, ???, ???]
[5, ???, ???]
is there any clue , solution to get correct data.
Can sombody guide me where am I going wrong.
Following is my java code.
cstmt.registerOutParameter(1, Types.INTEGER);
cstmt.setString(2, userId);
cstmt.setString(3, serverID);
cstmt.setString(4, platform);
cstmt.registerOutParameter(5, Types.ARRAY, otype);
cstmt.registerOutParameter(6, Types.VARCHAR);
cstmt.execute();
int result = cstmt.getInt(1);
Object obj = cstmt.getObject(5);
System.out.println(obj);
if (obj != null) {
System.out.println("Class: " + obj.getClass().getName());
}
Array arr = (Array) obj;
Object[] objArr = (Object[]) arr.getArray();
for (int i = 0; i < objArr.length; i++) {
Struct struct = (Struct) objArr;
Object[] attrs = struct.getAttributes();
System.out.println(Arrays.asList(attrs));
}
|
|
|