Bug 9581 - Invalid formatting and other errors in SqlBulkCopy.
Summary: Invalid formatting and other errors in SqlBulkCopy.
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: master
Hardware: All Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-01-15 15:24 UTC by GenomeXP
Modified: 2017-10-21 21:51 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description GenomeXP 2013-01-15 15:24:07 UTC
There is a long standing issue with SqlBulkCopy having incorrectly formatted column names (incorrectly adding collation) and several other problems. The same mono program when run with .net libraries will run and SqlBulkCopy will copy data fine, but when executed on the mono side will error out with sql problems.

This has been tested on Linux and Windows with 2.10.9 and 3.0.2 beta. There are two aging bug reports that seem to have remained untouched other than comments, commonly the column error gets reported as "Invalid syntax near ','".
https://bugzilla.novell.com/show_bug.cgi?id=580714
https://bugzilla.novell.com/show_bug.cgi?id=519844

An example of logged queries of .NET vs MONO in the same application:

.NET:
insert bulk [CData].[dbo].[locInfo]
([ip_rngf] Float,
 [ip_rngt] Float,
 [c_code] NVarChar(2) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [c_name] NVarChar(64) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [region_name] NVarChar(128) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [lat] Float,
 [long] Float,
 [pkey] NVarChar(10) COLLATE SQL_Latin1_General_CP1_CI_AS)
 
MONO:
 insert bulk [CData].[dbo].[locInfo]
([ip_rngf] Float(8) COLLATE ,
 [ip_rngt] Float(8) COLLATE ,
 [c_code] NVarChar(2) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [c_name] NVarChar(64) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [region_name] NVarChar(128) COLLATE SQL_Latin1_General_CP1_CI_AS,
 [lat] Float(8) COLLATE ,
 [long] Float(8) COLLATE ,
 [pkey] NVarChar(10) COLLATE SQL_Latin1_General_CP1_CI_AS)
Comment 1 Craig Morris 2013-10-11 15:15:35 UTC
I have done the work to fix this bug.  After fixing the reported issue, it was discovered none of the BulkCopy would work.  I downloaded the full TDS protocol spec and implemented all the needed changes.  It has been tested with almost all of the sql types and works well for our environment.  

I am now in the process of figuring out how to contribute the code changes back to the git mono repository.  I keep getting permission denied so I am now researching how I go about getting permission to contribute my changes back.
Comment 2 Craig Morris 2013-10-11 17:14:58 UTC
Pull request has been created to implement the changes in the mono base project.

https://github.com/mono/mono/pull/778
Comment 3 Alexander Köplinger [MSFT] 2017-10-21 21:51:58 UTC
Given the above pull request was merged a long time ago I'm closing this issue, thanks :)

Note You need to log in before you can comment on or make changes to this bug.