Bug 18801 - SqlBulkCopy doesn't work at all.
Summary: SqlBulkCopy doesn't work at all.
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-04-03 14:04 UTC by Don Clore
Modified: 2018-02-22 22:36 UTC (History)
1 user (show)

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


Attachments
A minimal C# console app that creates a datatable with one row added, opens a connection to Sql Server, creates a SqlBulkCopy object, and attempts to bulk copy to the server. (2.44 KB, text/x-csharp)
2014-04-03 14:04 UTC, Don Clore
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Don Clore 2014-04-03 14:04:48 UTC
Created attachment 6489 [details]
A minimal C# console app that creates a datatable with one row added, opens a connection to Sql Server, creates a SqlBulkCopy object, and attempts to bulk copy to the server.

As near as I can determine, System.Data.SqlClient.SqlBulkCopy doesn't work at all on Mono.   I'm attaching as minimal an example as I could contrive; sadly, by the nature of this problem, you have to stand up a Sql Server to reproduce this.  I included a snippet of T-Sql to create the table to attempt the bulkCopy into, and a sample connection string with secrets and database names removed so hopefully this can be fairly easily reproduced.

This sample works on .NET, all versions.   

My stack looks liks:

Bulk Copy failed, error = Incorrect syntax near ','., stack =   at System.Data.SqlClient.SqlConnection.ErrorHandler (System.Object sender, Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x00032] in /usr/src/packages/BUILD/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs:318 
  at Mono.Data.Tds.Protocol.Tds.OnTdsErrorMessage (Mono.Data.Tds.Protocol.TdsInternalErrorMessageEventArgs e) [0x0000b] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1719 
  at Mono.Data.Tds.Protocol.Tds.ProcessMessage (TdsPacketSubType subType) [0x000ef] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1759 
  at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x0012a] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:1811 
  at Mono.Data.Tds.Protocol.Tds.NextResult () [0x0004a] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:641 
  at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00005] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:714 
  at Mono.Data.Tds.Protocol.Tds.ExecBulkCopyMetaData (Int32 timeout, Boolean wantResults) [0x0001f] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:558 
  at Mono.Data.Tds.Protocol.TdsBulkCopy.SendColumnMetaData (System.String colMetaData) [0x00022] in /usr/src/packages/BUILD/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsBulkCopy.cs:54 
  at System.Data.SqlClient.SqlBulkCopy.BulkCopyToServer (System.Data.DataTable table, DataRowState state) [0x00246] in /usr/src/packages/BUILD/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.cs:415 
  at System.Data.SqlClient.SqlBulkCopy.WriteToServer (System.Data.DataTable table) [0x00000] in /usr/src/packages/BUILD/mcs/class/System.Data/System.Data.SqlClient/SqlBulkCopy.cs:531 
  at bc.bc.DoBulkCopy (System.Data.DataTable dataTable) [0x0002b] in /media/doncl/NTFS_DDRIVE/workspaces/bc/bc.cs:42
Comment 1 Marek Safar 2018-02-22 22:36:16 UTC
Mono 5.10 has significantly improved System.Data implementation which should resolve this issue. If you can still reproduce it please reopen the issue.