SSIS: Unable to Read from Excel file from a UNC path when deployed to server - sql

I appear to be unable to get my deployed SSIS package to read from a 1997-2003 Excel file.
I get stuck with the following 2 errors:
SSIS Error Code DTS_E_OLEDBERROR, Error code: 0x80004005 An OLE DB
record is available. Source Microsoft JET Database Engine, database
engine cannot open the file, it is already opened exclusively by
another user, or you need permission to view its data.
DTS_E_CANNOTAQUIRECONNECTIONFROMCONNECTIONMANAGER with Error code 0xC0202009
The package itself works with no issues when using SQL data tools on the server logged in as the service account only when deployed to server I see this issue.
To make this issue even more confusing I have setup and tried the following:
Runtime is set to 32 bit on the debugging menu on SQL data tools as well as the job configuration is set to use 32 bit runtime
I am able to UNC to the folder/file when logged in as the SQL service account
Any Ideas?
Thanks,
M

I figured it out in the end. Turns out I missed a step with the permissions.
Yes the Service account had permissions to the folder but I failed to add read permissions to the file itself.
Thanks for all comments/suggestions.
M

Related

SSIS package failing - Working in BIDS but not working after deployment - Package contains excel connection with sql command [duplicate]

I have a OLEDB task that connects to ms-access database on local file system and dumps data into sql database.
Access db connection string is: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.16.0;
The SSIS package runs OK in visual studio. Access 2016 32-bit runtime is installed on this computer.
After deployment to SSIS catalog, right click and execute works OK. Access 2016 64-bit runtime is installed on this computer.
When this package is scheduled to run via SQL Agent job, using proxy/credential [domain user - example: domainname\user1] (having read permission on the access db file), then the job fails. The SSIS execution report shows error as: Unexpected Termination. There is no further information.
Suppose if I add the proxy credential (domainname\user1) to the local administrators group (in computer management) then the SQL Job runs OK. What could be the solution to this so I can give only the minimum required permissions?
The error is very difficult to debug as it doesn't occur when running via visual studio. Even when deployed to the SQL server and run from the SSIS catalog, the execution works OK. The error occurs only when the package is run via SQL server agent job (via credential/proxy) - the SSIS execution report doesn't show any helpful messages; and surprisingly the error gets resolved when the credential is added as local administrator on the computer - which is a bad practice.
The solution is analyse what kind of ms access file you are using and appropriately use the correct access runtime version (2013 vs 2016) and the correct provider value in the connection string.
Access runtime:
In my case, I uninstalled Access 2016 64-bit runtime and installed Access 2013 64-bit runtime.
Provider version:
I changed the provider version from 16.0 to 15.0, as shown below-
Before: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.16.0;
After: Data Source=\\my-share\accessdbfile.accdb;Provider=Microsoft.ACE.OLEDB.15.0;
Note:
There is no need to add the user to the local administrator group.
There is no need to login to the computer using that account.
Only read permission (under windows folder security) is sufficient assuming the SSIS packge will only read the ms access database.
It's hard to debug this only with the information provided, but in general:
The user running the job requires at least write and delete access on the underlying folder in which the Access database resides. This is required to generate a lockfile for the database.
If this is undesirable because the job may be modified by a malicious user, I've seen deployments where a copy is made in a temporary folder with write access and a size quota, and that temporary folder is removed as soon as the job finishes, regardless of if the job succeeded.

Cannot create file because it already exists. Change the file path or the file name, and retry the operation

I created an asp.net mvc website with a code first database. I enabled database migration through the PM Console. I uploaded the website and database on to a server for online testing. I now want to do additional testing on my desktop so I downloaded the existing databases and placed them in the App_Data file.
Using the PM Console, I run the Update-Database command and the response is as follows:
PM> Update-Database
Specify the '-Verbose' flag to view the SQL
statements being applied to the target database. No pending explicit
migrations. Running Seed method.
I suspect that the database's schema is recognized as unchanged.
However, when I go to debug the website using localhost, after entering in username and password, I get the following error:
Cannot create file 'C:\Users\XXXX\OneDrive\Visual Studio
2017\Projects\Testing\XXXXXX\Version
2.4\XXXXXX\App_Data\DB_9AEA79_data.mdf' because it already exists. Change the file path or the file name, and retry the operation. CREATE
DATABASE failed. Some file names listed could not be created. Check
related errors.
I can't figure out why VS wants to re-create a database I've placed in the App_Data folder.
Any help would be greatly appreciated.
That’s because localDb uses an SqlServerExpress-Instance to use the database.
You can attach the file to the instance, but if you only copy the file it fails.
I didn’t check it and it’s old, but maybe the Docs can help you.
I am a newbie and this is my first post on this site, but I hope my post will help someone. I have the same message and for a long time I could not understand what is going on.
Cannot create file '' because it already exists. Change the file path or the file name, and retry the operation. CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I created an asp.net mvc project with an ms sql database and Entity Framework (code first). After creating the database, I immediately opened MS SQL Server Management Studio and added the database. After closing and reopening Visual Studio I always saw the same error (if I don't close VS everything works correctly).
It turned out to be caused by connection to MS SQL Server Management Studio. It's not enough to close the program, or to disable the connection.
Here's what needs to be done.
MS SQL SMS
I hope this helps someone.

SQL Server Database is not getting attached again

I tried to detach my SQL Server 2008 R2 database for creating a duplicate of it, meanwhile connections to that database were active from Visual Studio (2010). So SQL Server denied to detach. After closing Visual Studio, I tried again and my database was successfully detached.
After detaching my database I tried to copy both files (.mdf and .ldf) to another folder as a duplicate copy, but I could not do so because I was getting error that says
You require permission from the computer administrator to make changes to this file
I am using Windows 7 and my account is Administrator. I also tried to attach my database again to SQL Server (running it with administrator permission) but I got the following error:
Failed to retrieve data for this request. (Microsoft.SqlServer.Management.Sdk.Sfc)
Additional Information:
An exception occurred while executing a Transact-Sql statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
CREATE FILE encountered operating system error 5 (Access is denied,) while attempting to open or create the phyical file'C:/Mywor/MyDataBase.mdf'.
(Microsoft SQL Server, Error: 5123)
Please help me if someone know how to handle this problem.
Here are couple things you can try:
Stop SQL Server service and see if you can copy files (to stop SQL service go to SQL Server Configuration manager)
Try to copy some other database files in that directory and see if that works (make sure permissions for both files are exactly the same)
Try to copy .mdf and .ldf files in original SQL Server data directory (you can find it in SSMS -> Instance properties ->Database Settings
If you’re not using windows explorer for copying files make sure you run it as admin (right click -> Run as administrator)
This is a permissions issue on the database files directory, or the files themselves. Just because you're logged on as an administrator doesn't mean that Windows 7 allows you to do anything you want without whinging at you first. Also, the SQL Server service account may not have the appropriate permissions on the file/folder.

My job is running but no data is comming

I have got a ssis package which runs when I manually run from Integration Services. But when I try to run it from a job. Then it runs but no data is seen in the data. There seems to be some permission issue. Can somebody tell me what permissions are required for running a package from a SQL Server Job?
State the error message.
If you are using a flat file connection manager, and that's where the error is occurring, click 'start' then 'computer' then check to make sure you are mapped to that drive. If not, click the tab upper right corner to map to the drive then when you access the file through SSIS you shouldn't have an error.
If the package runs successfully as a job using the SQL Server Agent then you have the permissions set right for the database side.
However make sure if you are accessing any external data such as flat files that the agent is able to access these locations. You may have permissions on your Windows account to access the locations when you run the package in Visual Studio but the agent service running the job requires those permissions too.
If this is not the case can you clarify what your package does and any messages you receive from the catalog reports so I can help further.

SSIS Import excel sheet error

Hi I am tring to import data from excel to sql 2005 .working fine in VS2005,but not working while running from cmd using dtexec.
error description as follows
"Microsoft JET Database Engine" Hresult
: 0x80004005 Description: "The Microsoft Jet database engine could not find the
object .
Can anyone help how to resolve this issue
This could possibly be a permissions error. If the account that is running the package doesn't have sufficient rights on the target folder or object, then this kind of error could be raised by SSIS. You wouldn't see this error in BIDS if your personal account has sufficient rights to access the file location.
Do you receive this error when the package is executed via a SQL Server Agent job? Do you receive this error when logged into the server that runs the code using the credentials of the SQL Server Agent?
Try to see you you have the property 'Set DelayValidation' = false
(Microsoft Reference)
If it still does not work, check to see if you have the package sensible information, encrypted to the user package creator (package properties), this inhibits another user to run the package (safety issues).
Hope it helps,
Bruno