如何导入PostgreSQL数据库数据

如何导入PostgreSQL数据库数据,第1张

如将一Shapfile文件“c:\roadshp”导入到数据表“road”中,数据库为“sjzmap”。

1、运行“命令提示符”。

2、切换至PostgreSQL数据库安装目录中的bin目录下。

3、执行此目录下的shp2pgsql命令:“shp2pgsql c:\roadshp road > c:\roadsql”。

4、如将此文件直接导入数据库(不推荐):“shp2pgsql -c c:\roadshp road sjzmap | psql -d sjzmap”。

5、使用pgAdmin3 选择数据库,再导入表。

注:

Drops the database table before creating a new table with the data in the Shape file

Appends data from the Shape file into the database table Note that to use this option to load multiple files, the files must have the same attributes and same data types

Creates a new table and populates it from the Shape file

Only produces the table creation SQL code, without adding any actual data This can be used if you need to completely separate the table creation and data loading steps

Use the PostgreSQL "dump" format for the output data This can be combined with -a, -c and -d It is much faster to load than the default "insert" SQL format Use this for very large data sets

Creates and populates the geometry tables with the specified SRID

Keep identifiers' case (column, schema and attributes) Note that attributes in Shapefile are all UPPERCASE

Coerce all integers to standard 32-bit integers, do not create 64-bit bigints, even if the DBF header signature appears to warrant it

Create a GiST index on the geometry column

Output WKT format, for use with older (0x) versions of PostGIS Note that this will introduce coordinate drifts and will drop M values from shapefiles

Specify encoding of the input data (dbf file) When used, all attributes of the dbf are converted from the specified encoding to UTF8 The resulting SQL output will contain a command, so that the backend will be able to reconvert from UTF8 to whatever encoding the database is configured to use internally

打开软件,进入界面中。

双击“PostgresSQL 93”连接服务器

方法一:右键单击“postgres”,选择“新建对象”--新建数据库,设置新的数据库的参数,所有者一般默认为“postgres”

4

新建完后,不能立即看到界面上更新的数据,需要点击界面上的更新按钮才能够看到数据库的变化情况。

5

方法二:在插件中输入SQL语言,运行命令

6

方法三:点击面板上的“执行任意的SQL查询”

以上就是关于如何导入PostgreSQL数据库数据全部的内容,包括:如何导入PostgreSQL数据库数据、如何创建和连接 PostgreSQL 数据库、等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/sjk/10207114.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-06
下一篇2023-05-06

发表评论

登录后才能评论

评论列表(0条)

    保存