我有一个SSIS包,它使用Microsoft.ACE.OLEDB.12.0提供程序从制表符分隔的文本文件中读取信息。包中有一个脚本任务,其代码如下:
DataTable dtFiles = new DataTable();
string connStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileInfoLocation + ";Extended Properties=\"text;HDR=NO;FMT=TabDelimited\"";
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM RepairFiscalYears.txt", connStr);
adapter.Fill(dtFiles);
这个包作为本地用户运行,比方说UserA。最近,一位同事在运行SSIS包的同一个盒子上创建了一个Windows服务。服务的“登录身份”设置为与SSIS包运行时相同的UserA。现在当我尝试运行SSIS包时,我在adapter.Fill(dtFiles)行上出现以下错误。
EXCEPTION THROWN: 12/31/2014 3:04:06 AM
Unspecified error
Source: Microsoft Access Database Engine
HelpLink:
StackTracee: at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at ST_ee4c7bf65c87474397e28ea0f96c53d9.ScriptMain.Main()
如果我停止服务并运行包,它可以正常工作。如果我重新启动该服务并运行该程序包,它将失败,因此我可以轻松地重现该问题。为什么在与SSIS包相同的用户下运行的Windows服务会导致与OLEDB提供程序的这种冲突?
请记住,Windows服务不会对包执行任何操作,即不会从任何相同的位置/文件/等读取/写入。
非常感谢任何帮助。