Microsoft XML Bulkload for SQL Server: Error connecting to the data source.
Attach a part of the code:
Perl:
The foreach $filebase (@ SQLXMLPhase1)
{
The local $xsdFilePathName="${SOURCE} \ \ ${filebase} XSD";
$xsdFilePathName=~ s/\. \ \//g;
Print "DIR:" ${SOURCE}, "REGEXPR: ${filebase} [. ^ \] * \. XML \ n";
Opendir (DIR, "${SOURCE}") or print ERROR: "always open a ${SOURCE} for search \ n";
The local @ allfiles=readdir (DIR);
Closedir (DIR);
{foreach $xmlfile (@ allfiles)
If (" ${xmlfile} "=~/${filebase} [. ^ \] * \. XML/I) {
The local $filePathName="${SOURCE} ${xmlfile} \ ";
$filePathName=~ s/\. \ \//g;
System (" ${SOURCE} \ \ BulkLoad cscript WSF \ "provider=SQLOLEDB. 1; The DATABASE=Concorde; QuotedID=No. Trusted_Connection=Yes; SERVER=${used to} \ "${xsdFilePathName} ${filePathName} & gt;> The ${OUTPUT} \ \ xmlBulkLoad out ");
}
}
}
Bulkload. WSF:
//set up the database connection string
Var connectString=WScript. The Arguments (0);
//var connectString="default";
If (connectString=="default")
{
Var networkObj=new ActiveXObject (" Wscript.Net work ");
ConnectString="provider=SQLOLEDB. 1; The DATABASE=Concorde; QuotedID=No. Trusted_Connection=Yes; SERVER="+ networkObj.Com puterName +" \ \ MERCURYA0 ";
}
WScript. Echo (" DB Connection String: \ n "+ connectString);
//create bulk loader
Var x=new ActiveXObject (" SQLXMLBulkLoad. SQLXMLBulkLoad. 4.0 ");
X.C onnectionString=connectString;
X.E rrorLogFile="bulkLoadError. Log";
X.I gnoreDuplicateKeys="true";
WScript. Echo (" Schema File: \ n "+ WScript. The Arguments (1) +" \ nData File: \ n "+ WScript. The Arguments (2));
x.E xecute (WScript. The Arguments (1), WScript. The Arguments (2));//XSD and XML
</script>