File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "data to long for column" Watch "data to long for column" New topic

data to long for column

egbai mmumene
Ranch Hand

Joined: Sep 18, 2012
Posts: 46
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

Joined: Aug 22, 2010
Posts: 3733

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:
subject: data to long for column
It's not a secret anymore!