<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 for the link. I tried psql with my computer and it gives the error <BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><STRONG>FATAL: Ident authentication failed for user "username" Error and Solution. </STRONG></SPAN><BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><STRONG></STRONG></SPAN> <BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><STRONG>I google it, and find the solution could be by modifying the </STRONG><BR><PRE><FONT size=2 face=Courier>pg_hba.conf file. I modified the file and saved. After I run your code again it comes another error:</FONT></PRE><PRE><PRE style="MARGIN: 0em">Could not connect to server: permission denied.
Is the server running locally and accepting
connections on Unix domain socket "var/run/postgresql/.s.PGSQL.5432"</PRE><PRE style="MARGIN: 0em"></SPAN><SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><STRONG>Somebody suggested this solution:</STRONG></SPAN></PRE></PRE>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"><STRONG></STRONG></SPAN> <BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">The permissions on the socket file var/run/postgresql/.s.PGSQL.5432<BR>Ordinarily the postmaster will create the socket as world-writable,<BR>but evidently not this time.  Perhaps you have set a nonstandard value<BR>for "unix_socket_permissions"?  Another possibility is that it's not<BR>the socket file itself, but /var that is mis-permissioned.<BR></SPAN><BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">I didnīt know how to solve this problem. Do I have to install web server such as apache in my machine? I have used chmod 777 to change the right of var/run/postgresql/.s.PGSQL.5432, but it still doesnīt work.</SPAN><BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Can you help me? </SPAN><BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"></SPAN> <BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA">Thanks</SPAN><BR>
<SPAN style="FONT-FAMILY: 'Times New Roman'; FONT-SIZE: 12pt; mso-fareast-font-family: SimSun; mso-ansi-language: EN-US; mso-fareast-language: ZH-CN; mso-bidi-language: AR-SA"> <BR><BR></SPAN>
<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>> zhang zhe wrote:<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>