Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Error inserting a BLOB data type in MySQL

That it odd, our LOB tests do not seem to encounter this issue on MySQL.  It
seems to be a driver issue, from the log EclipseLink is just binding the
byte[] value, where as the SQL that the driver passed to the database seems
to have printed the byte[] into the SQL.  Perhaps check your driver for
updates or contact MySQL.

You may also try using stream binding in EclipseLink, (SessionCustomizer,
DatabaseLogin.setUsesStreamsForBinding(true)),
or maybe even try without binding,



drcriado wrote:
> 
> Hi!
> 	
> My application fail to insert a BLOB data type. I have researched and
> tested several alternatives but always gives me the same error.
> 
> any suggestions?
> 
> Regards.
> 
> Daniel R. Criado
> 
> ========
> Platform
> =======
> 
> - EclipseLink version: 1.1.1.v20090430-r4097 (using javax.persistent_1.99)
> - Spring Framework 2.5.6
> - MySQL 5.1.33-community
> - MYSQL Connector 
> 
> ===========
> Class Code:
> ===========
> 
> @Entity
> public class Test8 implements Serializable {
> 	@Id
> 	@GeneratedValue(strategy=GenerationType.IDENTITY)
> 	private int id;
> 
> 	private String name;
> 
> 	@Lob
> 	private byte[] desc;
> 
> 	@Temporal(TemporalType.TIMESTAMP)
> 	private Date date;
> 
> 	private static final long serialVersionUID = 1L;
> 
> 	public Test8() {
> 		super();
> 	}
> 
> 	public int getId() {
> 		return this.id;
> 	}
> 
> 	public void setId(int id) {
> 		this.id = id;
> 	}
> 
> 	public String getName() {
> 		return this.name;
> 	}
> 
> 	public void setName(String name) {
> 		this.name = name;
> 	}
> 
> 	public byte[] getDesc() {
> 		return this.desc;
> 	}
> 
> 	public void setDesc(byte[] desc) {
> 		this.desc = desc;
> 	}
> 
> 	public Date getDate() {
> 		return this.date;
> 	}
> 
> 	public void setDate(Date date) {
> 		this.date = date;
> 	}
> 
> }
> 
> =======
> Database Script
> =======
> 
> CREATE  TABLE EXISTS `test8` (
>   `id` INT NOT NULL AUTO_INCREMENT ,
>   `name` VARCHAR(45) NULL ,
>   `desc` LONGBLOB NULL ,
>   `date` DATETIME NULL ,
>   PRIMARY KEY (`id`) )
> ENGINE = InnoDB;
> 
> ==========
> Error description
> =========
> 
> [EL Warning]: 2009-05-25
> 20:06:26.281--UnitOfWork(189219)--Thread(Thread[main,5,main])--Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 1.1.1.v20090430-r4097):
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
> error in your SQL syntax; check the manual that corresponds to your MySQL
> server version for the right syntax to use near 'DESC, NAME, DATE) VALUES
> (_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
> Error Code: 1064
> Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
> 	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
> Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8)
> class org.springframework.orm.jpa.JpaSystemException  Exception
> [EclipseLink-4002] (Eclipse Persistence Services - 1.1.1.v20090430-r4097):
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
> error in your SQL syntax; check the manual that corresponds to your MySQL
> server version for the right syntax to use near 'DESC, NAME, DATE) VALUES
> (_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
> Error Code: 1064
> Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
> 	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
> Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8); nested exception
> is javax.persistence.PersistenceException: Exception [EclipseLink-4002]
> (Eclipse Persistence Services - 1.1.1.v20090430-r4097):
> org.eclipse.persistence.exceptions.DatabaseException
> Internal Exception:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an
> error in your SQL syntax; check the manual that corresponds to your MySQL
> server version for the right syntax to use near 'DESC, NAME, DATE) VALUES
> (_binary'<html>\r\n<body>\r\n\r\nThe classes in this pa' at line 1
> Error Code: 1064
> Call: INSERT INTO TEST8 (DESC, NAME, DATE) VALUES (?, ?, ?)
> 	bind => [[B@1dacccc, prueba, 2009-05-25 20:06:25.718]
> Query: InsertObjectQuery(leandra.test1_8.Test8@12c8fa8)
> 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Error-inserting-a-BLOB-data-type-in-MySQL-tp23711038p23725525.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top