1

I have a simple web application to upload files and store them in a longblob into a mysql database. But I get the following exception:

Caused by: java.sql.SQLException: Incorrect string value: '\xA2\x04\x02(\xA0\x00...' for column 'value' at row 1
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504)
    at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
    ... 68 more

Here is my form:

<form id="myForm" action="/creategroup" enctype="multipart/form-data" method="POST">
    <input type="file" name="component_1" id="component_1">
    and other stuff...

Here is my Hibernate definition for the field:

@Audited
@Column(name = "value")
@Lob
private byte[] value;

Here is my mysql definition for the field:

value LONGBLOB NOT NULL

What may be the issue? What should I check? What should I change to make it working?

user1883212
  • 7,539
  • 11
  • 46
  • 82

0 Answers0