首页 文章

OLE DB提供程序'OraOLEDB.Oracle'不能用于分布式查询

提问于
浏览
-1

尝试在ASP.NET中执行Oracle SP时出现以下错误 . 这里没有链接服务器概念 . 我使用Oracle连接直接连接到Oracle .

System.Data.SqlClient.SqlException:OLE DB提供程序'OraOLEDB.Oracle'不能用于分布式查询,因为提供程序配置为在单线程单元模式下运行 . 在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,布尔breakConnection)在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)在系统系统中System.Data.SqlClient.SqlDataReader.get_MetaData()的System.Data.SqlClient.SqlDataReader.ConsumeMetaData()处于.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj) System.Data.SqlClient.SqlCommand的System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async)中的.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString) . RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String meth OD,DbAsyncResult结果)在System.Data.SqlClient.SqlCommand.RunExecuteReader(的CommandBehavior cmdBehavior,RunBehavior runBehavior,布尔returnStream,字符串方法)在System.Data.SqlClient.SqlCommand.ExecuteReader(的CommandBehavior行为,字符串方法)在System.Data . SqlClient.SqlCommand.ExecuteDbDataReader(的CommandBehavior行为)在System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(的CommandBehavior行为)在System.Data.Common.DbDataAdapter.FillInternal(数据集的数据集,数据表[]数据表,的Int32 startRecord ,的Int32最大记录,字符串srcTable要,IDbCommand的命令,的CommandBehavior行为)在System.Data.Common.DbDataAdapter.Fill(数据集的数据集,的Int32 startRecord,的Int32最大记录,字符串srcTable要,IDbCommand的命令,的CommandBehavior行为)在System.Data.Common.DbDataAdapter .Fill(DataSet dataSet,String srcTable)

1 回答

  • 1

    'OraOLEDB.Oracle'是从MS技术连接到各种数据库的通用实现 . 它是COM中的STA(单线程单元)实现,因此当内部代码尝试为分布式查询生成另一个线程时,它会抛出异常,因为STA不是线程安全的实现 . .Net进程是MTA(多线程公寓),这意味着它们可以一次处理多个线程 . 查看这些链接以获取更多信息:

    Could you explain STA and MTA?

    Single-Threaded Apartments vs Multi-Threaded Apartments

    最好的选择是转移到ODP.Net,这是一个纯粹的.Net产品,不会有这样的问题 . 它内置了对Oracle支持的分布式查询/事务的支持 . 事实上,你将使用ORAMTS,这是Oracle的MSDTC(MS分布式事务协调员)的钩子

相关问题