I've found a solution
INSERT INTO XXX (
...
"JSON_FILE" ,
...
) VALUES (
...
FILE_READ('classpath:/j1.json') ,
...
) ;
See
https://stackoverflow.com/questions/38353487/insert-blob-from-a-file-into-a-sql-script-to-embed-h2-database
Le mercredi 9 octobre 2019 10:25:38 UTC+2, Philip Roc a écrit :
>
> Hi Eyvgenij,
>
> here's the situation. My colleagues and I are currently working on a
> Spring Boot project that uses Oracle. However, although one of the
> developers has managed to install Oracle 11 on his machine, the 4 others
> haven't,
> probably because of company-wide security policies (who knows). Instead of
> spending precious development time figuring out why Oracle won't install,
> we've decided to use H2 instead for development purposes.
>
> The schema-h2.sql script in ou project creates a table containing a BLOB
> column (when the Spring Boot Profile is "h2").
>
> I would like to store a sample json file (200 lines) in the in-memory DB,
> to test the GET REST request, during development.
>
> For instance,
>
> GET /myservice/<invoice id>
>
> returns
>
> { "id": 2, "invoicename" : "123", etc. }
>
> Cheers,
>
> Phil
>
>
>
>
>
>
>
>
>
> Le mercredi 9 octobre 2019 07:55:17 UTC+2, Evgenij Ryazanov a écrit :
>>
>> BLOB or CLOB values in in-memory database? Bad idea in general, when you
>> use an in-memory database, it should be small enough.
>>
>> If you want to connect to the database from another process, you need to
>> start a TCP Server inside of the process that owns the database.
>>
>> org.h2.tools.Server tcp = org.h2.tools.Server.createTcpServer(…);
>> tcp.start();
>>
>> Another process should use the remote URL to connect to this server.
>>
>> You can also launch a separate H2 Server process and connect to it from
>> both your applications.
>>
>> If you use Hibernate, you can use Hibernate.getLobCreator(…) I guess. Why
>> you want to mix different methods to deal with the database?
>>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/h2-database/0a63f0cd-9b4e-4a67-b50c-01c7c50178c6%40googlegroups.com.