mapbox / windows-builds

DEPRECATED! build scripts for mapnik dependencies, mapnik, node-mapnik, node, libosmiom, osmium-tool
38 stars 22 forks source link

OGR Plugin: connection failed: MSSQL:Server #37

Closed wilhelmberg closed 9 years ago

wilhelmberg commented 9 years ago

Why is this failing?

Error: OGR Plugin: connection failed: MSSQL:Server=.\sqlexpress2012;database=netmapnik;trusted_connection=yes;Tables=countries; was not found or is not a supported format  encountered during parsing of layer 'countries' in Layer of './style.xml'
wilhelmberg commented 9 years ago

@springmeyer FYI Leaving this ticket open as a reminder to check back, when either

@sjmorrow Short story: Sorry, don't know how this slipped through, but right now, it's not possible to provide MSSQL connectivity.


Long story:

To get MSSQL connectivity with gdal/ogr it is necessary to build gdal with ODBC support, linking to Odbccp32.lib.

To build mapnik/node-mapnik it is necessary to use at least VS2014 CTP 2 or newer (latest version currently VS2015 CTP6), because we make heavy use of C++11 features.

With VC2014/2015 Microsoft has made big changes to the VC++ runtime and how it interoperates with other libraries (e.g. Odbccp32.lib).

As these new VS versions are still CTP (Community Technology Preview) Microsoft has not yet updated all dependent libraries.

I've searched high and low and tried every hint I could find, but was not able to compile gdal (with ODBC enabled) with VS2014 CTP14 or VS2015 CTP6. I've tried latest stable release 1.11.2 and latest source, to no avail.

sjmorrow commented 9 years ago

@BergWerkGIS Thank you very much for looking into this.

Out of curiosity, do you think if I rolled back to node-mapnik@1.4.17 (which doesnt require C++11, correct?) that MSSQL would work?

sjmorrow commented 9 years ago

I'll admit that I currently have zero understanding of the windows build process, but is it possible that the answer on this Connect issue would solve the problem until Microsoft finalizes VS2015? https://connect.microsoft.com/VisualStudio/feedback/details/1039102

wilhelmberg commented 9 years ago

Thanks for your input, but I've already tried the suggested solution of that Connect issue (additionally linking to legacy_stdio_definitions.lib).

Out of curiosity, do you think if I rolled back to node-mapnik@1.4.17 (which doesnt require C++11, correct?) that MSSQL would work?

Yes, just veryfied that node-mapnik@1.4.17 can connect to MSSqlServer.

But remember, that you still have to take care of the extent by yourself, otherwise you will get this error:

Error: OGR Plugin: Cannot determine extent for layer 'SELECT'. Please provide a manual extent string (minx,miny,maxx,maxy)
jbrwn commented 9 years ago

@BergWerkGIS - Just an FYI I am getting the same error in NET-Mapnik which is using the following mapnik-sdk binaries:

http://mapnik.s3.amazonaws.com/dist/dev/mapnik-win-sdk-14.0-x86-v3.0.0-rc1-277-ge04b061.7z http://mapnik.s3.amazonaws.com/dist/dev/mapnik-win-sdk-14.0-x64-v3.0.0-rc1-277-ge04b061.7z

It looks like this issue has probably been around since at least 1/14/2015.

wilhelmberg commented 9 years ago

@jbrwn thanks for letting me know. The issue exists since we moved to VS2014/2015, because since then I haven't been able to compile gdal with ODBC support, which is necessary for SQL Server access. As far as I've found out, we have to wait till Microsoft has updated their libraries to match the new runtime. See above

BHare1985 commented 9 years ago

I want to use node-mapnik but I figured it had the same MSSQL compatibility as Mapnik. What is the newest/latest version in which MSSQL works with node-mapnik?

wilhelmberg commented 9 years ago

@BHare1985 No news here, still waiting for a Odbccp32.lib from Microsoft that works with VS2015 (or finding a workaround).

Latest node-mapnik able to connect to MSSQL is 1.4.17.

Also, @jbrwn is currrently working on a native mapnik plugin to connect to MSSQL: https://github.com/mapnik/mapnik/issues/2797

BHare1985 commented 9 years ago

@BergWerkGIS

Seems this issue has been submitted to VS ( https://connect.microsoft.com/VisualStudio/feedback/details/1039102 ) but they closed it when the original author did not provide a demo project. Perhaps going this same avenue or emailing James McNellis may result into something.

Same author posted here with a potential fix: https://social.msdn.microsoft.com/Forums/en-US/b63a5ba5-71a9-4758-a6ea-a419836c3285/vs-2015-unresolved-external-when-linking-to-odbc-libs?forum=vcgeneral

I assume you have seen these in your search for solutions, but just in case included them here.

I am glad to hear of the MSSQL plugin for mapnik. I assume it will be integrated with node-mapnik.

wilhelmberg commented 9 years ago

@BHare1985 Thanks for getting back, but as stated above, I've already tried the suggestions mentioned in those two links (and some others). Unfortunately none of them worked for me.

jbrwn commented 9 years ago

@BHare1985, @BergWerkGIS - Just fyi... The plugin i'm developing is also based on ODBC but i am not running into any linker errors. I seem to be avoiding the function calls that are causing issues in GDAL.

I am glad to hear of the MSSQL plugin for mapnik. I assume it will be integrated with node-mapnik.

To be honest i am not really sure how the integration with node-mapnik will work. From my conversations with @flippmoke in mapnik/mapnik#2797 it looks like the core development team is pushing for plugins to made available as separate packages and not directly via the core mapnik-sdk or language bindings themselves.

wilhelmberg commented 9 years ago

The plugin i'm developing is also based on ODBC but i am not running into any linker errors.

Interesting. Are you using VS2015 RC?

To be honest i am not really sure how the integration with node-mapnik will work.

I think the idea is, that the core mapnik sdk provides just a few very common input plugins out of the box.

Additional plugins (e.g. MSSQL.input) can then just be dropped into the input folder of mapnik or node-mapnik.

jbrwn commented 9 years ago

@BergWerkGIS - Yes it builds on VS2015 RC.

Additional plugins (e.g. MSSQL.input) can then just be dropped into the input folder of mapnik or node-mapnik.

Yeah i understand how the actual plugins work. My point was that it won't just "show up" in node-mapnik without some sort of additional installer. Maybe i'm overthinking it...

wilhelmberg commented 9 years ago

@BHare1985 @jbrwn @springmeyer

Progress report: I was able to successfully compile gdal with ODBC support with VS2015 RC1 by additionally linking to legacy_stdio_definitions.lib. Don't know why it hasn't worked before, as I'm 200% sure, I had already tried that.

Will take a few days till I can provide a test version of mapnik sdk and node-mapnik with ODBC support and built with RC1, as I'm pretty busy with other things.

@jbrwn

My point was that it won't just "show up" in node-mapnik without some sort of additional installer.

I think so, too. Dropping a file into the correct folder sounds very easy for us developers, but providing a seamless experience for end users might provide some additional challenges.

wilhelmberg commented 9 years ago

@BHare1985 @jbrwn @sjmorrow mapnik SDK built with VS2015 RC1 and gdal MSSQL support:

x64: https://mapnik.s3.amazonaws.com/dist/dev/vs2015rc1/mapnik-win-sdk-14.0-x64-v3.0.0-rc1-1158-g73dbec3.7z

x86: https://mapnik.s3.amazonaws.com/dist/dev/vs2015rc1/mapnik-win-sdk-14.0-x86-v3.0.0-rc1-1158-g73dbec3.7z

wilhelmberg commented 9 years ago

@BHare1985 @jbrwn @sjmorrow

Closing. I couldn't find any way to get MSSQL support working with VS2014 CTP4 (our current build chain).

It will still take some time, till we will have moved all our tools and native node addons that rely on mapnik to VS2015 RC. Ping me, if you need an updated SDK, built with VS2015 RC, in the meantime.