SQL批量加载期间的问题
我们遇到了一个真正令人困惑的问题。我们正在尝试使用我们编写的一个小应用程序来测试 SQL 批量加载,该应用程序传入数据文件 XML、架构和 SQL 数据库连接字符串。
这是一个非常简单的应用程序,这是代码的主要部分:
SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();
objBL.ConnectionString = "provider=sqloledb;Data Source=SERVER\\SERVER; Database=Main;User Id=Username;Password=password;";
objBL.BulkLoad = true;
objBL.CheckConstraints = true;
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute("schema.xml", "data.xml");
如您所见,它非常简单,但我们从将这些内容传递到的库中收到以下错误:Interop.SQLXMLBULKLOADLib。 dll。
该消息显示:
失败:尝试读取或写入受保护的内存。这通常表明其他内存已损坏
我们不知道是什么原因造成的,甚至不知道它意味着什么。
在此之前,我们首先遇到一个错误,因为没有安装 SQLXML4.0,所以很容易修复。然后出现错误,因为它无法连接到数据库(连接字符串错误) - 已修复。现在出现了这个,我们只是感到困惑。
感谢您的任何帮助。我们真是摸不着头脑!
we've got a real confusing problem. We're trying to test an SQL Bulk Load using a little app we've written that passes in the datafile XML, the schema, and the SQL database connection string.
It's a very straight-forward app, here's the main part of the code:
SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class objBL = new SQLXMLBULKLOADLib.SQLXMLBulkLoad4Class();
objBL.ConnectionString = "provider=sqloledb;Data Source=SERVER\\SERVER; Database=Main;User Id=Username;Password=password;";
objBL.BulkLoad = true;
objBL.CheckConstraints = true;
objBL.ErrorLogFile = "error.xml";
objBL.KeepIdentity = false;
objBL.Execute("schema.xml", "data.xml");
As you can see, it's very simple but we're getting the following error from the library we're passing this stuff to: Interop.SQLXMLBULKLOADLib.dll.
The message reads:
Failure: Attempted to read or write protected memory. This is often an indication that other memory has been corrupted
We have no idea what's causing it or what it even means.
Before this we first had an error because SQLXML4.0 wasn't installed, so that was easy to fix. Then there was an error because it couldn't connect to the database (wrong connection string) - fixed. Now there's this and we are just baffled.
Thanks for any help. We're really scratching our heads!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不熟悉这个特定的实用程序 (Interop.SQLXMLBULKLOADLib.dll),但是您是否检查过您的 XML 是否验证了其架构 .xsd 文件?如果 xml 数据文件无效,也许 dll 在将 xml 数据文件加载到内存结构时可能会出现问题?
I am not familiar with this particular utility (Interop.SQLXMLBULKLOADLib.dll), but have you checked that your XML validates to its schema .xsd file? Perhaps the dll could have issues with loading the xml data file into memory structures if it is invalid?
我试图理解你的问题,但我对此有更多疑问,
如果你有时间尝试访问下面的链接,我认为它肯定对你有用
链接文本
I try to understand your problem ,but i have more doubt in that,
If u have time try access the below link ,i think it will definitely useful for you
link text
我知道我做了一次引发此错误消息的操作,但是(正如经常发生的那样)问题最终与错误消息无关。没有太多帮助,唉。
一些故障排除想法:尝试确定应用程序生成并提交到 SQL Server 的实际 SQL 命令(SQL Profiler 应该在这里提供帮助),并尽可能“靠近”数据库运行它 - 从 SSMS 内部,使用 SQLCMD,直接 BCP 调用,无论什么都合适。详细说明您所做的所有测试以及获得的结果可能会有所帮助。
I know I did something that raised this error message once, but (as often happens) the problem ended up having nothing to do with the error message. Not much help, alas.
Some troubleshooting ideas: try to determine the actual SQL command being generated and submitted by the application to SQL Server (SQL Profiler should help here), and run it as "close" to the database as possible--from within SSMS, using SQLCMD, direct BCP call, whatever is appropriate. Detailing all tests you make and the results you get may help.