[mapserver-users] OGR ODBC Layer with Password
Jeff McKenna
jmckenna at gatewaygeomatics.com
Tue Dec 17 12:36:21 PST 2013
On 2013-12-17 4:14 PM, Donald Kerr wrote:
> Any takers (see email below)? Help appreciated.
>
> Regards,
>
> Donald
>
> -----Original Message-----
> From: Donald Kerr [mailto:donald.kerr at dkerr.co.uk]
> Sent: 12 December 2013 16:45
> To: 'Donald Kerr'
> Subject: OGR ODBC Layer with Password
>
> Hi All,
>
> I have a layer that uses OGR to connect to an Microsoft Access database via
> ODBC.
>
> CONNECTIONTYPE OGR
> CONNECTION "ODBC: MyDNSName,MyTableName" # Requires GEOMETRY_COLUMNS table
> (SPATIAL_REF_SYS optional) - Fails if DATA included in this map file
>
> The above works on a database without password protection. When I add a
> password to the database, I would expect to be able to connect using the
> following line:
>
> CONNECTION "ODBC:Admin/MyPassword at MyDNSName,MyTableName" # Requires
> GEOMETRY_COLUMNS table (SPATIAL_REF_SYS optional) - Fails if DATA included
> in this map file
>
> But I get the following error in the log file:
>
> [Thu Dec 12 16:22:35 2013].484000 msDrawMap(): WMS/WFS set-up and query,
> 0.000s [Thu Dec 12 16:22:35 2013].484000
> msOGRFileOpen(ODBC:Admin/MyPassword at MyDSNName,MyTableName)...
> [Thu Dec 12 16:22:35 2013].484000 OGROPen(ODBC:Admin/MyPassword at MyDSNName)
> [Thu Dec 12 16:22:35 2013].515000 msOGRFileOpen(): OGR error. Open failed
> for OGR connection in layer `MyLayerName'.
> Unable to initialize ODBC connection to DSN for Admin/MyPassword at MyDSNName,
> [Microsoft][ODBC Microsoft Access Driver] Not a valid password
>
> The only difference is the username and password being included in the
> connection string.
>
> If I run the following at the command line, all works well:
>
> C:\ >ogrinfo ODBC:Admin/MyPassword at MyDSNName,MyTableName
> INFO: Open of `ODBC:Admin/MyPassword at MyDSNName,MyTableName'
> using driver `ODBC' successful.
> 1: MyTableName
>
> It would appear that the Username and Password are being ignored or changed
> when used by MapServer since ogrinfo is working correctly and opening the
> connection.
>
> Any ideas?
>
> Many thanks.
>
> Regards,
>
> Donald
>
>
If this is all hosted on the same Windows machine, what happens if you
leave out the user/pass? eg. ogrinfo ODBC:@DSN table
-jeff
--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/
More information about the MapServer-users
mailing list