Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

SSIS package failing for EXCEL source in 64 bit environement

$
0
0

I am creating SSIS package programmatically. (using SQL Server 2008 & C#). I am facing one issue during excel file import in 64 bit environment.

I am using 'Microsoft.ACE.OLEDB.12.0' provider to connect to excel file. This code is working fine in X86, or AnyCPU in visual studio.

Whereas the same code is crashing in 64 bit environment while acquiring the connection.

I had already installed "AccessDatabaseEngine_x64" in that environment for 64 bit excel drivers.

Here's the code snippet I am using  for configuring the Excel Source component.

privateConnectionManager _connectionManagerExcelFile;

Packagepackage=newPackage();

package.Name="ImportExcel Data";

package.CreationDate=DateTime.Now;

package.ProtectionLevel=DTSProtectionLevel.EncryptSensitiveWithPassword;

package.Description="ImportExcel Data";

package.DelayValidation=true;

package.PackageType=Microsoft.SqlServer.Dts.Runtime.DTSPackageType.DTSDesigner100;

ConnectionManager _connectionManagerExcelFile=package.Connections.Add("EXCEL"); _connectionManagerExcelFile.ConnectionString=string.Format(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties=""Excel 12.0;HDR=No""", conn);

_taskHost
= _executableDataFlowTask asTaskHost;

if(_taskHost !=null) _dataFlowTask =(MainPipe)_taskHost.InnerObject;                           

_componentSource
= _dataFlowTask.ComponentMetaDataCollection.New();

_componentSource
.Name="Excel Source (Sheet1)";

_componentSource
.ComponentClassID="DTSAdapter.ExcelSource.2";

// Get source design-time instance, and initialise component
_instanceSource
= _componentSource.Instantiate();

_instanceSource
.ProvideComponentProperties();

// Set source connection
_componentSource
.RuntimeConnectionCollection[0].ConnectionManagerID= _connectionManagerExcelFile.ID;

_componentSource
.RuntimeConnectionCollection[0].ConnectionManager=

DtsConvert.GetExtendedInterface(_connectionManagerExcelFile);

// Reinitialize the metadata,
_instanceSource
.SetComponentProperty("AccessMode",0);

_instanceSource
.SetComponentProperty("OpenRowset",'Sheet1$');

_instanceSource
.AcquireConnections(null); // here I am getting error

_instanceSource
.ReinitializeMetaData();

_instanceSource
.ReleaseConnections();

---------------------------------------------------------------------------

Error while it is trying to acquire connection with the source file

message- Exception from HRESULT: 0xC020801C
source -Microsoft.SqlServer.DTSPipelineWrap
Stack Trace-
at Microsoft.SqlServer.Dts.Pipeline.Wrapper.CManagedComponentWrapperClass.AcquireConnections(Object pTransaction)

-------------------------------------------------------------------------------

Microsoft Office Access database engine 2007(English)

Microsoft Access database engine 2010(English)

Both of these i installed.But still getting the same error


Viewing all articles
Browse latest Browse all 24688

Trending Articles