Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Data truncation while inserting.

 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

I am trying to insert a query which has a very lengthy string of char 380.
We are using Prepared Statement to carry out the insert.
I am able to retrieve the full string from the JSP and display it in Action class.When i checked the logs the value passed contains the full string of 380char.But when i try to retrieve the value i am not able to get the full length of String.Then i tried to insert using the QMF tool.
it is not allowing me to insert since the string is very lengthy.
But actually the column i am trying to insert can hold upto 3800 varchar.
Again when i tried to insert through QMF by reducing the length of String to 255,i was able to do the insert.

I dont know what should i check or do to insert my full string.
ANy help or hint will be really useful.

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a database problem -- you'll have to give more details about your environment. Moving to our JDBC forum.
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To add more information.
We are using DB2.Weblogic server.Please let me know if more information is needed.
Thanks
 
meena latha
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also tried to insert the string two time,like i splited the string into two part.After inserting the first string i updated the second string using pipping method.

UPDATE TABLENAME SET COLUMN_NAME = COLUMN_NAME || "STRING" WHERE CLAUSE

It worked fine when i tried using QMF(Tool to execute and see the query).
But when i used in java class,it is giving me exception.

This is how is used this query in my java class.

UPDATE TABLE_NAME SET COLUMN_NAME = COLUMN_NAME || ? WHERE CLAUSE.

I am passing the value of the String.
I am getting "Host variable is too length".Not sure why this is happening.

Any help will be really useful.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic