【YashanDB知识库】如何使用jdbc向YashanDB批量插入gis数据

以gis表为例:drop table gis;create table gis(id number not null, pos st_geometry not null);使用如下的java代码片断,可以向gis表中插入POINT类型的gi

【YashanDB知识库】如何使用jdbc向YashanDB批量插入gis数据

以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();

connmit();

最终效果:

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.

发布者:admin,转转请注明出处:http://www.yc00.com/web/1748195875a4745932.html

相关推荐

  • 【YashanDB知识库】如何使用jdbc向YashanDB批量插入gis数据

    以gis表为例:drop table gis;create table gis(id number not null, pos st_geometry not null);使用如下的java代码片断,可以向gis表中插入POINT类型的gi

    3小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信