Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes DB2 VARCHAR Truncation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DB2 VARCHAR Truncation" Watch "DB2 VARCHAR Truncation" New topic
Author

DB2 VARCHAR Truncation

Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
I running an nt client w/ IE 5.x, apache web server, JRUN, and DB2 on an OS/390. I have a data truncation problem when inserting a row into a column defined as a VARCHAR(3000).
Only 255 out of 1000 bytes is being inserted.
Any ideas...

[This message has been edited by Monty Ireland (edited December 14, 2001).]


Multi Platform Database Developer & DBA on E.S.T.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I don't know what DB2's limitations are, but after a certain length or a string, you have to stream the data into the database(but usually an exception is thrown???). Are you streaming the data in? Post a code snippet showing the insert procedure, that should help us help you!
Jamie
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
I'm in the middle of porting a software package from oracle to db2... code sample is unavailable at this time... but, the code works on sql-server and oracle. My client is using a prepared statement to select a row from an application table.
Thanks for asking...
And the answer is... the database engine.
select * from table where varchar100 = 'fred' works
select * from table where varchar255 = 'fred' works
select * from table where varchar256 = 'fred' fails
select * from table where varchar999 = 'fred' fails
If you replace the string 'fred' with a host variable containing the string 'fred'. Then all of the sql queries above will then work! I am in the process of opening a PMR request with IBM tosee if there is an APAR to fix this problem...


[This message has been edited by Monty Ireland (edited December 14, 2001).]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: DB2 VARCHAR Truncation
 
Similar Threads
TreeSet sorting dropping elements
Data truncation issue
How to pass Java Objects into Stored Procedure in DB2
Mapping Varchar to Number
amount of text - performance