When I'm synchronizing image from android to server, it throws this exception:

data truncation: data too long for column


@DatabaseField(dataType = DataType.BYTE_ARRAY)

private byte[] PERSON_IMAGE;

I am using ormlite for android and the image is saved correctly. I also extract the DB of android on emulator and the image is of type blob in db.


@Column(name = "PERSON_IMAGE", columnDefinition = "BLOB")
@Basic(fetch = FetchType.EAGER)
byte[] personImage;

I am using hibernate 4.1.3 to persist in mysql DB. My schema is autogenerated by hibernate. The image is also of type blob in mysql. Glad if you can help to sort this out. The exception is throws only when it persists in mysql.

Edited by samantha2015

2 Years
Discussion Span
Last Post by hericles

In mysql a blob has a maximum size of 65 kilobytes whereas I believe the mysqlite version of a blob is significantly more than that (I'm assuming you are using mysqlite when you say you're saving the image to android).
You'll need to increase your MySql blob type to mediumblob or longblob.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.