Hi!
>>>>> "Josep" == Josep Curto <orion@stripped> writes:
Josep> Hi,
Josep> I use a JAVA Servlet to acces a MySQL DB via a JDBC driver.
Josep> All works fine, but now I want to INSERT a BLOB Field with binary data to
Josep> the DB, and I can't.
Josep> Really, the binary data is a JPG file that I want to put in the DB.
Josep> With the SQL String :
Josep> "INSERT INTO Fotos (ID_Objecte, Titol, Descripcio, Imatge) VALUES (1,"Name
Josep> of Picture","Description","BINARY DATA OF THE JPG FILE")" I get an
Josep> error : SQLException from MySQL.
Josep> It only works if the data I INSERT to the LONGBLOB field is text DATA, for
Josep> example the contents of a HTML FILE. If the DATA is
Josep> BINARY, don't work.
Sorry, I don't know enough about the java driver to be able to answer
this. Which Java driver are you using.
Josep> I've read that I can't LOAD FROM FILE a BLOB Field. I think only SQL
Josep> Commands as INSERT INTO and UPDATE are used to add rows to a Table of the
Josep> DB.
There isn't any problems to use LOAD DATA INFILE with blob/text
columns as long as you read whole rows into a table.
Josep> My question is, how can I INSERT BINARY DATA to a LONGBLOB Field in a MySQL
Josep> DB?
Regards,
Monty