aspose file tools*
The moose likes JDBC and the fly likes data to long for column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "data to long for column" Watch "data to long for column" New topic
Author

data to long for column

egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 43
Been working on my application but keep receiving an error message saying data too long for column tried to change data types nothing works out.
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3434
    
  47

This error message usually mean the text you're trying to write to a column is longer than the maximum width of the column. The same error might also mean that a numeric value is bigger than what a numeric column will allow, and some other types (LOBs, for example, might probably produce similar messages, depending on your DB).

Does the error message at least specify the column name? In that case, have a good look on the definition of that column in the database, and inspect the value your're writing to it correctly. In case of text column it can still be troublesome, as some databases measure length of columns in bytes, not characters, and using a multi-byte character set may mean that the value will be too long even if the number of its characters does not exceed the width of the column.

If you're unlucky to use a database which does not include the name of the column in the error message, it's a lot more of work, but generally you'll just inspect every column and value you're trying to insert as described in the previous paragraph.

If you're unable to sort it out yourself, then please post your code, the description of your table, which database are you using and the full text of the error message. Perhaps someone acquainted with the database will be able to offer some specific advice.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data to long for column
 
Similar Threads
Q about java.sql.ResultSet: how to store text in LONG column
Spring + Hibernate
Struts Unstring the data
LONG VARCHAR
preparedstatement throws sqlexception