MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Josep Curto Date:March 18 1999 7:30am
Subject:INSERTING BLOB Fields in a Table
View as plain text  

I use a JAVA Servlet to acces a MySQL DB via a JDBC driver.
All works fine, but now I want to INSERT a BLOB Field with binary data to
the DB, and I can't.
Really, the binary data is a JPG file that I want to put in the DB.
With the SQL String :
"INSERT INTO Fotos (ID_Objecte, Titol, Descripcio, Imatge) VALUES (1,"Name
of Picture","Description","BINARY DATA OF THE JPG FILE")"        I get an
error : SQLException from MySQL.

It only works if the data I INSERT to the LONGBLOB field is text DATA, for
example the contents of a HTML FILE. If the DATA is
BINARY, don't work.

I've read that I can't LOAD FROM FILE a BLOB Field. I think only SQL
Commands as INSERT INTO and UPDATE are used to add rows to a Table of the

My question is, how can I INSERT BINARY DATA to a LONGBLOB Field in a MySQL

INSERTING BLOB Fields in a TableJosep Curto18 Mar
  • INSERTING BLOB Fields in a TableMichael Widenius18 Mar
  • Re: INSERTING BLOB Fields in a TableChristian Mack18 Mar