Howto insert geometry in h2 using sql

geospatial, h2, spatial, sql

Solution

As far as I see, the suffix `SRID=4326` is not WKT (Well-Known Text), but EWKT.

The H2 database currently does not support EWKT (Extended Well-Known Text). You would have to use `'POINT(7 52)'`. A complete example:

create table feature(id int, name varchar(255), 
description varchar(255), geom geometry);
insert into feature (id, name, description, geom) values
(1, 'example name', 'example description', 'POINT(7 52)');

Problem

Since a couple of versions, h2 does have support for spatial geometries. It's not a problem to select and insert geometries in java. But how can insert them in pure sql? Documentation shows it uses WKT. But when I try to insert in WKT I got an error. That's an example insert: ``` insert into feature (id, name, description, geom) values (1, 'example name', 'example description', 'SRID=4326;POINT(7 52)'); ``` Thanks for any hints!

Original source