[postgis-users] import shape or sql to postgres automatically
zhang zhe
luckyclare at hotmail.com
Tue Dec 14 00:26:34 PST 2010
Hello,
Thanks. Actually, I have windows and apache server installed in my computer. In this case how the code should look like?
What´s the mylinuxserver ? is it the IP adress of the server? or name of the server?
Will my code changed into
psql.exe -h mywindowsServer -d postgres -U zhe -f c:/users/sqlfile.sql
Can I write this code to php?
Thanks.
psql.exe -h mylinuxserver -d mydatabase -U myuser
-f c:/users/sqlfile.sql
> Date: Mon, 13 Dec 2010 12:13:44 +0000
> From: mark.cave-ayland at siriusit.co.uk
> To: postgis-users at postgis.refractions.net
> Subject: Re: [postgis-users] import shape or sql to postgres automatically
>
>
> > Hello,
> >
> > Does anyone know how to import sql table or shape file to postgres
> > database automatically?
> > What I did before is:
> > I have shpe file save in C:/users
> > I go to terminal in linux, and go to the directory C:/users
> > C:/users shp2pgsql shapefile.shp > sqlfile.sql
> > I will get sql file saved into c:/users directory. I open the sql file
> > copy all the sql query. After that I open postgres database, and paste
> > all the query to sql query window, and run the query. I will have new
> > table appear in the dabase.
> >
> > Sometimes the sql table is too large, that I cannot paste them all in
> > the postgres sql query window. Postgres is always get stuck because of
> > the query is too large.For instance I have road dataset of whole contry,
> > and it has really millions of queries. Is there any way to import shape
> > file or sql table to Postgres database automatically without any manual
> > work?
>
> Assuming you have the PostgreSQL client installed on your local Windows
> workstation, it sounds as if you need to pass the -f option to psql and
> then use -h to connect to your linux server instead, e.g:
>
> psql.exe -h mylinuxserver -d mydatabase -U myuser
> -f c:/users/sqlfile.sql
>
> HTH,
>
> Mark.
>
> --
> Mark Cave-Ayland - Senior Technical Architect
> PostgreSQL - PostGIS
> Sirius Corporation plc - control through freedom
> http://www.siriusit.co.uk
> t: +44 870 608 0063
>
> Sirius Labs: http://www.siriusit.co.uk/labs
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101214/040356c2/attachment.html>
More information about the postgis-users
mailing list