Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncated Objects in java.sql.ResultSet

Status
Not open for further replies.

ro88o

Programmer
Jun 25, 2005
24
0
0
GB
Hi,

I have a field in a (Sybase 12.52) database that is 2048 characters and when I run a sql query on a command line it shows all the text inside this field. However, when I run a sql query from java and obtain a java.sql.ResultSet I find that when I do:

Code:
Object myObject = resultSet.getObject(i);

...the contents of myObject has been truncated to 256 characters long rather than the 2048 it is in the database. Can anybody tell me a possible reason for this please?

Thanks in advance for any help you can offer!
 
I take it that

String s = rs.getString(i)

returns the same ...

What datatype is the field in the table ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Yep the rs.getString(i) returns the same thing unfortunately. The field type is varchar. Any ideas :) ?
 
Wasn't there a limit of 255 characters for varchars when using ODBC? Are you using a JDBC/ODBC bridge?

Cheers,
Dian
 
I would say this was a driver issue then.
Like Dian says - what driver are you using ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
I'm using the Sybase drivers and I think I may have found what the problem is. Apparently if the version isn't set to 6 then you can have problems with wide tables and truncation, I'm currently working on setting the version but I'm having some problems importing the classes I need :-(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top