[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] import shape or sql to postgres automatically
From:       zhang zhe <luckyclare () hotmail ! com>
Date:       2010-12-17 12:54:31
Message-ID: SNT110-W43BB0508982EFC51FD9DB2DE160 () phx ! gbl
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,
 
Thanks for the link. I tried psql with my computer and it gives the error 
FATAL: Ident authentication failed for user "username" Error and Solution. 
 
I google it, and find the solution could be by modifying the pg_hba.conf file. I \
modified the file and saved. After I run your code again it comes another error: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"Somebody \
suggested this solution:  
The permissions on the socket file var/run/postgresql/.s.PGSQL.5432
Ordinarily the postmaster will create the socket as world-writable,
but evidently not this time.  Perhaps you have set a nonstandard value
for "unix_socket_permissions"?  Another possibility is that it's not
the socket file itself, but /var that is mis-permissioned.

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. Can you help me? 
 
Thanks
 


 
> Date: Mon, 13 Dec 2010 12:13:44 +0000
> From: mark.cave-ayland@siriusit.co.uk
> To: postgis-users@postgis.refractions.net
> Subject: Re: [postgis-users] import shape or sql to postgres automatically
> 
> zhang zhe wrote:
> 
> > 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@postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
 		 	   		  


[Attachment #5 (text/html)]

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



_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic