wxz44428

'Received an invalid column length from the bcp client for colid xx' error when calling AFDatabase.ApplyChanges

Discussion created by wxz44428 on Feb 18, 2013
Latest reply on Feb 19, 2013 by pcombellick

We are coding against AF SDK 2.4, and trying to programatically creating UoM and Element templates. However, we ran into an issue, as described below.

 

We are adding a list of ElementTemplates in a loop, by calling the following in the loop

 

AfDatabase.AElementTemplates.Add(templateName);

 

Then we add attributes to each of the ElementTemplate, after which, we will call

 

AfDatabase.ApplyChanges() method. However, this call will fail with the following error:

 

Timestamp: 2/18/2013 7:17:35 PM
Message: Unexpected Server Error: 'SQL Error (4815) Received an invalid column length from the bcp client for colid 20.'.
Use Event Viewer to see the AF service log file for more information. (157b9d26-2866-4746-9876-5c90f88df1f1)
System.InvalidOperationException: Unexpected Server Error: 'SQL Error (4815) Received an invalid column length from the bcp client for colid 20.'.
Use Event Viewer to see the AF service log file for more information.
   at OSIsoft.AF.Support.AFSerialProxy.ApplyChangesElementTemplate(dcElementTemplate[] changes, dcObjectIdentity[] deletedIdentities) in c:\Builds\AF\AF 2.4\Sources\SDK\Support\AFProxy.Remote.cs:line 3886
   at OSIsoft.AF.Asset.AFElementTemplate.RemoteApplyChangesElementTemplate(AFDatabase database, Boolean databaseCheckIn, dcElementTemplate[] changes, dcObjectIdentity[] deletedIdentities) in c:\Builds\AF\AF 2.4\Sources\SDK\Asset\AFElementTemplate.Remote.cs:line 128
   at OSIsoft.AF.AFDatabase.SaveElementTemplates(Boolean doCheckIn, Boolean mustApplyChangesForListCheckIn, Boolean disableObjectListCheckIn, IDictionary`2 processedItemsDict, List`1 appliedList, List`1& changeList, List`1& deleteList) in c:\Builds\AF\AF 2.4\Sources\SDK\AFDatabase.Remote.cs:line 1465
   at OSIsoft.AF.AFDatabase.ProcessDatabaseChanges(Boolean doCheckIn, AFCheckedOutMode mode, IEnumerable`1 objList, List`1 appliedList) in c:\Builds\AF\AF 2.4\Sources\SDK\AFDatabase.Remote.cs:line 875
   at OSIsoft.AF.AFDatabase.ProcessDatabaseChanges(Boolean doCheckIn, AFCheckedOutMode mode) in c:\Builds\AF\AF 2.4\Sources\SDK\AFDatabase.Remote.cs:line 504
   at OSIsoft.AF.AFDatabase.ApplyChanges(AFCheckedOutMode mode) in c:\Builds\AF\AF 2.4\Sources\SDK\AFDatabase.cs:line 915

 

The same code base seems to work fine when running on a different AF server, but fails on this box. Anyone with any experience on this, facing similar errors before ?

 

Someone seems to suggest that, since we are adding elementTemplates in bulk (we add the templates in loop first), then outside of the loop, we call applyChanges in one shot, there might be a seting somewhere in AF, that might limit the among of data to be send to AF for updating. Is that true, if there is, what would be that AF config setting ?

 

We do not have a dev environment on this box, so making the troubleshooting a bit difficult. Any of your kind assistance will be highly appreciated.

 

Thanks,

 

Joe

 

 

 

 

 

 

 

 

 

 

Outcomes