[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>
<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>
_______________________________________________
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