Export
returns the filename to which your data was exported. Your code does insert that filename into your database, and you see that this actually does work. What you most probably want is to insert the file content, not the filename, into the database. For that you need a combination of ExportString
, ToCharacterCode
and SQLBinary
. This is described, as Ajasja has mentioned, in the documentation for SQLBinary
. Here is how it would look like for your example:
filecontent = ToCharacterCode[ExportString[resultimg1,"JPEG"]];
SQLInsert[conn,"mathematica",{"image"},{SQLBinary[filecontent]}];
Depending on how you are going to read the data you might need to take care of the correct encoding, if you read and write both from the same machine with Mathematica I believe the defaults should work alright.
Export
returns the full path to the file it wrote and that's what you are inserting into your database. If, as I guess, you want to write the file content instead of the filename you could e.g. useExportString
andToCharacterCode
to get a binary representation of the file content to insert into your database... $\endgroup$