I'm creating a SQL script to create a new schema and insert some values to an embed H2 database for use with integration tests in a Spring Boot application. One of the values I need to insert is a BLOB field on the sql table.
I've succesfully used the FILE_READ
function as described here.
INSERT INTO MY_TABLE(ID, NAME, LOGO)
VALUES('1', 'test1', FILE_READ('C:/myproject/logo.png'));
That function works well with full paths but I'm not been able to do that with relative paths. That doesn't work well when the sources are downloaded and compiled (plus testing) in any other machine than mine.
I need to insert into a sql script a BLOB field from a binary file, loaded from a relative path from the project that owns that script.
I've searched and found this aproach: insert a BLOB via a sql script?
But RAWTOHEX
function seems to work with Strings, and my input is a binary file.
Any ideas?