[mapserver-users] SQL Server 2012 connection
saka royban
sakaroyban at yahoo.com
Sat Jul 5 16:16:15 PDT 2014
Hi all.
I've loaded a shapefile to SQL Server 2012 (in Windows 2008 R2) as follows:
ogr2ogr -f "MSSQLSpatial"
"MSSQL:server=localhost;database=mydb;trusted_connection=yes"
"C:\streets2.shp" -a_srs "EPSG:26918"
I can confirm that it has loaded, because i can view this layer in QGIS 1.8
and Also can export that as follows:
ogr2ogr -f "ESRI Shapefile" "C:\streets2.shp"
"MSSQL:server=localhost;database=mydb;trusted_connection=yes;" -sql "SELECT
ogr_geometry FROM streets2" -overwrite -lco "SHPT=ARC" -a_srs "EPSG:26918"
The problem arises when i wanna load that layer in mapfile. My mapfile is as
follows:
MAP
NAME "MyMap"
EXTENT 562996.375999 4483049.109631 609777.312060 4529931.787066
# Geographic
SIZE 800 400
IMAGECOLOR 255 255 255
SHAPEPATH '../data'
FONTSET '../fonts/fonts.list'
SYMBOLSET '../symbols/symbols35.txt'
IMAGETYPE png
CONFIG "MS_ERRORFILE" "stdout" # to send errors
CONFIG "CPL_DEBUG" "ON"
CONFIG "PROJ_DEBUG" "ON" # turn on debugging for projection to see PROJ4
errors
DEBUG 5
LAYER
NAME "streets"
CONNECTIONTYPE OGR
CONNECTION
"MSSQL:server=localhost;database=mydb;tables=streets2(ogr_geometry);trusted_connection=yes;"
STATUS ON
TYPE line
CLASS
COLOR 0 50 50
END
PROCESSING 'CLOSE_CONNECTION=DEFER'
END
END
I get following error in error file of Apache:
[Sat Jul 05 12:41:57 2014] [error] [client 127.0.0.1] malformed header from
script. Bad header=[Microsoft][ODBC SQL Server Dr: mapserv.exe
[Sat Jul 05 12:41:58 2014] [error] [client 127.0.0.1] OGR_MSSQLSpatial:
EstablishSession(Connection:"server=localhost;database=nyc;trusted_connection=yes;")\r
[Sat Jul 05 12:41:58 2014] [error] [client 127.0.0.1] ODBC:
SQLDriverConnect(DRIVER=SQL
Server;server=localhost;database=nyc;trusted_connection=yes;)\r
[Sat Jul 05 12:41:58 2014] [error] [client 127.0.0.1] ODBC: ... failed:
[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot open database "nyc"
requested by the login. The login failed.\r
[Sat Jul 05 12:41:58 2014] [error] [client 127.0.0.1] ODBC:
SQLDisconnect()\r
How is it possible? Login failed? I could connect already with this
connection information using OGR, and now mapserver cannot connect.
I also added a SQL Server authentication(username and password) and used
that in connection string instead of "trusted_connection=yes", but no
change.
Any idea? or any one encountered this problem before?
Regards
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/SQL-Server-2012-connection-tp5149799.html
Sent from the Mapserver - User mailing list archive at Nabble.com.
More information about the MapServer-users
mailing list