[gdal-dev] Has ogr2ogr support for BCP Bulk Load on Unix?

Hector muro muro.hector at gmail.com
Tue Jun 30 03:50:16 PDT 2020


Hi,

I've seen that there is support for BCP bulk load support since gdal 2.1.0,
but from other posts in this list and all mentions in the docs, it looks as
if this support is only available for Windows, not unix (I hope I am wrong
and my problem comes from somewhere else), e.g.:


   - https://lists.osgeo.org/pipermail/gdal-dev/2018-May/048520.html
   -
   http://osgeo-org.1560.x6.nabble.com/gdal-dev-connect-mssql-from-linux-td5363547.html



And here:
https://gdal.org/drivers/vector/mssqlspatial.html#configuration-options

"*MSSQLSPATIAL_USE_BCP*: (From GDAL 2.1.0) Enable bulk insert when adding
features. This option requires to to compile GDAL against a bulk copy
enabled ODBC driver like SQL Server Native Client 11.0. To specify a BCP
supported driver in the connection string, use the driver parameter, like
DRIVER={SQL Server Native Client 11.0}. If GDAL is compiled against SQL
Server Native Client 10.0 or 11.0 the driver is selected automatically not
requiring to specify that in the connection string. If GDAL is compiled
against SQL Server Native Client 10.0 or 11.0 the default setting of this
parameter is TRUE, otherwise the parameter is ignored by the driver."

It all references SQL Server Native Client and even in the code I've seen
"sqlncli", whereas the driver in Linux for SQL Server is called "ODBC
Driver XX for SQL Server", e.g.:

[ODBC Driver 17 for SQL Server]
Description=Microsoft ODBC Driver 17 for SQL Server
Driver=/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.5.so.2.1

(Also, what does "compile GDAL against a bulk copy enabled ODBC driver
like" mean? I have built GDAL from source, configuring it with the
flag --enable-driver-mssqlspatial)

So I am wondering how does gdal checks if there is BCP Support? Like these
lines that i.e. #ifdef MSSQL_BCP_SUPPORTED? Is it a "Windows"-check feature?

I am asking because we have gdal and SQL Server on a CentOS machine and we
certainly have BCP, SQLCMD and other SQL Server tools available, but when
using ogr2ogr to load source files into a SQL Server instance it does not
use BCP. It instead loads one-by-one and this causes the process to be
really slow.

SQL Server version: 2017
GDAL version: 3.0.4

Any help/tips will be very appreciated.

Thanks

Hector Muro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200630/6863ca1d/attachment.html>


More information about the gdal-dev mailing list