Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 SSIS C# Zip Files

Author  Topic 

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2014-01-13 : 13:00:51
Hi,

I have an ssis package, that traverses through loads of folders and returns paths to all the zip files inside them.

I can then read inside the zip file and return all the names of the csv's inside them, and when i pass the name of the csv's so \\networkpath\folder\subfolder\file.zip\numbers.csv

it complains the path does not exist even though when I copy and paste the path onto file explorer it opens fine.

Many thanks in advance.

copy of my code below:

FileInputStream fis = new FileInputStream(zipFilePath);
ZipInputStream zis = new ZipInputStream(fis);
ZipEntry ze;

//Loop through all files in the zip file
while ((ze = zis.getNextEntry()) != null)
{
//File name format in zip file is:
String filename = ze.getName();
String newname = filename;
newname = newname.Replace("/", @"\");
//Full filename and path
String fullfilename = zipFilePath + @"\" + newname;

FileInfo fileinfo;

fileinfo = new FileInfo(filename);

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-13 : 14:14:13
is the package executed from the same machine?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2014-01-14 : 04:07:45
The folders are on different server, i was thinking of looking at aspnet permissions, but any other suggestions too?

thanks

quote:
Originally posted by visakh16

is the package executed from the same machine?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-14 : 04:23:07
quote:
Originally posted by cipriani1984

The folders are on different server, i was thinking of looking at aspnet permissions, but any other suggestions too?

thanks

quote:
Originally posted by visakh16

is the package executed from the same machine?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





then it may be that the account executing ssis package doesnt have access to those folders. is ssis executed from sql agent job or bat file?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

cipriani1984
Constraint Violating Yak Guru

304 Posts

Posted - 2014-01-14 : 08:44:53
Im running this manually at the moment from BIDS.

How would I find out what service/account it is running under?

quote:
Originally posted by visakh16

quote:
Originally posted by cipriani1984

The folders are on different server, i was thinking of looking at aspnet permissions, but any other suggestions too?

thanks

quote:
Originally posted by visakh16

is the package executed from the same machine?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs





then it may be that the account executing ssis package doesnt have access to those folders. is ssis executed from sql agent job or bat file?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs


Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2014-01-15 : 05:52:55
If you're running manually it uses your logged in credentials.
If that being case put a breakpoint and check if code is getting corect expected value for filepath.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
   

- Advertisement -