inserting image in sql
Hello everyone,
I am trying to use this query to insert image in mysql db.
let qur2 = `INSERT INTO products(photo) VALUES(LOAD_FILE('${photoPath}'))`
where photPath is:
photoPath = 'Macintosh HD/Users/somename/Final/download.jpeg';
it inserts a null in db, and throws no error.
And I also tried the following query:
let qur3 = `INSERT INTO products (photo) SELECT * FROM OPENROWSET( BULK N'${photoPath}', Blob) image`;
this time it throw an error as
"ER_PARSE_ERROR: 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 '( BULK N'Macintosh HD/Users/somename/Final/download.j' at line 1"}
It will be appreciated if somebody can help me in this regard.
Subject
Written By
Posted
inserting image in sql
October 01, 2019 08:46AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.