本文内容来自YashanDB官网,原文内容请见 https://www.yashandb.com/newsinfo/7817897.html?templateId=171...

以gis表为例:

drop table gis;

create table gis(id number not null, pos st_geometry not null);

使用如下的java代码片断,可以向gis表中插入POINT类型的gis数据:

conn.setAutoCommit(false);

PreparedStatement ps = conn.prepareStatement("insert into gis values(?,ST_GEOMFROMTEXT(?))");

for(int i = 0; i < 10; i++) {

    ps.setInt(1, 1);

    ps.setString(2, "POINT(-137.690708 33.187434)");

    ps.addBatch();

}

ps.executeBatch();

conn.commit();

最终效果:

SQL> select id, st_astext(pos) from gis;

ID ST_ASTEXT(POS)

----------- ----------------------------------------------------------------

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

1 POINT (-137.690708000000001 33.187434000000003)

 

10 rows fetched.

YashanDB
1 声望0 粉丝

崖山数据库系统YashanDB是深圳计算科学研究院自主设计研发的新型数据库管理系统,融入原创的有界计算、近似计算、并行可扩展和跨模融合计算理论,可满足金融、政企、能源等关键行业对高性能、高并发及高安全性的...