SSIS 2012 Excel 带有来自变量的动态 ConnectionString 的源

SSIS 2012 Excel Source with Dynamic ConnectionString from Variable

我有一个简单的 SSIS 2012 包:

尝试动态分配 ConnectionString 时,出现错误:

[Excel Source [2]] Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager "FUNB" failed with error code 0xC0209303. There may be error messages posted before this with more information on why the AcquireConnection method call failed.

我尝试了以下方法:

  1. 通过浏览到实际文件添加连接管理器。将 Excel 源连接到它。预览数据。
  2. 手动加载文件后,更新连接管理器属性。设置 ConnectionString 表达式:

    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+@[User::SourceFileExcel]+";Extended Properties=\"EXCEL 8.0;HDR=Yes; IMEX=1\";"
    
  3. 上面产生了错误。将表达式更改为 ExcelFilePath 设置为:

    @[User::SourceFileExcel]
    

ExcelFilePathConnectionString 表达式都会产生相同的错误。我已经在 Excel 连接管理器和数据流对象上使用 DelayValidation=True 进行了尝试。

我在同一台服务器上还有另一个包,其工作方式大致相同,但使用的是 CSV 连接。这个包运行正常。两个源文件文件夹的 Windows 安全权限相同。

对我做错了什么有什么想法吗?

我认为在连接到 excel 2007 或更高版本时,您应该使用 Microsoft.ACE.OLEDB.12.0 作为提供程序,还要确保您不是 运行 64 位模式的软件包

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + @[User::SourceFileExcel] + ";Extended Properties=\"Excel 12.0;HDR=YES\";"

或者试试下面的格式(不用写Extended Properties)

"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + @[User::SourceFileExcel] + ";Excel 12.0;HDR=YES;IMEX=1"

如果这些建议中的 none 行得通,那么我认为这不是表达式问题,您面临的是 the same issue in this link

问题可能是在机器上发现了64位office安装,需要安装32-bit AccessDatabaseEngine