<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'>
Hello,<BR>
 <BR>
Thanks. Actually, I have windows and apache server installed in my computer. In this case how the code should look like? <BR>
What´s the mylinuxserver ? is it the IP adress of the server? or name of the server? <BR>
 <BR>
Will my code changed into <BR>
psql.exe -h mywindowsServer -d postgres -U zhe -f c:/users/sqlfile.sql<BR>
 <BR>
Can I write this code to php? <BR>
 <BR>
Thanks. <BR>
 <BR>
psql.exe -h mylinuxserver -d mydatabase -U myuser<BR> -f c:/users/sqlfile.sql<BR> <BR>
> Date: Mon, 13 Dec 2010 12:13:44 +0000<BR>> From: mark.cave-ayland@siriusit.co.uk<BR>> To: postgis-users@postgis.refractions.net<BR>> Subject: Re: [postgis-users] import shape or sql to postgres automatically<BR>> <BR>> <BR>> > Hello,<BR>> > <BR>> > Does anyone know how to import sql table or shape file to postgres <BR>> > database automatically?<BR>> > What I did before is:<BR>> > I have shpe file save in C:/users<BR>> > I go to terminal in linux, and go to the directory C:/users<BR>> > C:/users shp2pgsql shapefile.shp > sqlfile.sql<BR>> > I will get sql file saved into c:/users directory. I open the sql file <BR>> > copy all the sql query. After that I open postgres database, and paste <BR>> > all the query to sql query window, and run the query. I will have new <BR>> > table appear in the dabase.<BR>> > <BR>> > Sometimes the sql table is too large, that I cannot paste them all in <BR>> > the postgres sql query window. Postgres is always get stuck because of <BR>> > the query is too large.For instance I have road dataset of whole contry, <BR>> > and it has really millions of queries. Is there any way to import shape <BR>> > file or sql table to Postgres database automatically without any manual <BR>> > work?<BR>> <BR>> Assuming you have the PostgreSQL client installed on your local Windows <BR>> workstation, it sounds as if you need to pass the -f option to psql and <BR>> then use -h to connect to your linux server instead, e.g:<BR>> <BR>> psql.exe -h mylinuxserver -d mydatabase -U myuser<BR>> -f c:/users/sqlfile.sql<BR>> <BR>> HTH,<BR>> <BR>> Mark.<BR>> <BR>> -- <BR>> Mark Cave-Ayland - Senior Technical Architect<BR>> PostgreSQL - PostGIS<BR>> Sirius Corporation plc - control through freedom<BR>> http://www.siriusit.co.uk<BR>> t: +44 870 608 0063<BR>> <BR>> Sirius Labs: http://www.siriusit.co.uk/labs<BR>> _______________________________________________<BR>> postgis-users mailing list<BR>> postgis-users@postgis.refractions.net<BR>> http://postgis.refractions.net/mailman/listinfo/postgis-users<BR>                                           </body>
</html>