SOLUTION - - RE: [postgis-users] Mapserver / PostGIS Layer

Lowther, David W dlowther at
Tue Jan 7 08:56:48 PST 2003

Hello All,

Thanks to all so much for your help with this. Frank, you won't believe

I have no idea WHY but here is the solution:

I was using IP address of Postgres server in my connection. As soon as I
changed from IP to name the problem was resolved.

So, host= wont work, but works. But works inside the same domain as postgres server.

Go figure.

Hope this will help someone sometime.


-----Original Message-----
From: Lowther, David W [mailto:dlowther at]
Sent: Monday, January 06, 2003 10:07 AM
To: Mapserver-Users (E-mail); Postgis-Users (E-mail)
Subject: [postgis-users] Mapserver / PostGIS Layer

Hi List and Happy New Year!

I have been struggling with a situation related to Mapserver and PostGIS
layers and I was hoping someone might help me out.

I have PostGIS running on Redhat. I have 2 web/mapserver (3.6.3) servers
(Intel WinNT4.0 IIS4.0) that access this PostGIS database. One is a test
server (located in the same domain as the PostGIS server) and one is a live
server (located in a separate domain from the PostGIS server). Using the
same connection information in a mapfile the test server can access and map
the PostGIS database with no problem - as could the live server when it was
in the domain - but the live server fails to connect with an error
(msPOSTGISLayerOpen(): Query error. Error parsing POSTGIS connection
information.) now that it is outside the domain. I am stressing the domain
issue here because I can't think of any other difference in the two servers.

- PGAdmin from the live server connects with no problem.
- ODBC connectivity from the live server works fine.
- The mapfiles on the test and live servers are identical except for
necessary directory differences.
- Checked password, hostname, connection type, socket connections enabled as
instructed in debug version of Mapserver build, but if they work on the test
server shouldn't they work on the live?
- Added live server to pg_hba.conf although test server does not appear and
connects successfully:
	 host        all      trust
- Initialize postmaster with -i option to allow tcp/ip connections.
- tcpip_socket=true in postgresql.conf.
- Tried using port=5432 in the CONNECTION param for mapfile - no difference
in behaviour.

Heres the layer from the mapfile:
### ROADS ###
	GROUP "Selected"
	NAME "gradyRoads"
	CONNECTION "user=*** password=*** dbname=*** host=***"
	DATA "the_geom from (select oid,* from roads) as foo"

	TEMPLATE "IDgradyRoads.htm"
		NAME "Grady Roads"
		SYMBOL "line"
		SIZE 2
		COLOR 10 200 100 
		legend_order "5"

Would anyone be willing to try connecting to the PostGIS server using
Mapserver if I were to provide ip, db, un, and pwd info? I'm just completely
stuck at this point.

Thanks so much for everyone's help getting me to this point and thanks in
advance for all your help with this issue,

David Lowther
Software Engineer
GEO Information Systems
University of Oklahoma
dlowther at
(405) 325-3131

postgis-users mailing list
postgis-users at

More information about the postgis-users mailing list