How to access network file using stored procedure? - sql-server-2008

I have a problem. SQL Server service runs under the built-in Network Service account on Server_01. A Stored Procedure (on Server_01) needs to read the files from a shared folder on Server_02. But for whatever reasons, SP can't find the file.
Shared folder has "Everyone /Full Control" users. And I can get access of shared file on Server_01 manually.
I also tried with map drive but didn't work. I mean I can see file of Server_02 on Server_01 but SP can't find it.
What permissions do I need to set on the shared Folder on Server_02? How this stored procedure can get access of file from another server.
NOTE : These two Servers (01 and 02) are not in Domain.

Related

SSIS: "Access to the path ':Z\zfilepath' is denied."

I am having trouble moving a folder from an online drive, Drive :Z\zfilepath
to my local drive, Drive C:\cfilepath
So far, I have one 'file system task' that can copy a file from a source and move it to a destination.
I have correctly specified both filepaths and folder names into the task.
When I run the package, I get the following error:
[File System Task] Error: An error occurred with the following error message: "Access to the path ':Z\zfilepath' is denied.".
Is there some way for me to set up the package such that it will have the credentials to access the online :Z\ drive and run the task?
Z is likely a mapped drive. A drive is mapped per user account so the probable error is that the account that runs SQL Agent (or the credentialed user running a task) does not have that same drive mapped.
One maps a drive from the command line (Execute process task) with the following syntax
net use z: \\server\share PasswordInClearTextHere /user:domain\user /persistent:yes
I don't know enough about your environment. Maybe a one-time activity of mapping the drive will suffice /persistent:yes.
We had an issue where we always had to re-establish the mount when the job ran but we couldn't be certain the previous job succeeded (which had a final step of tear down the mount). Attempting to mount a drive when one already exists will throw an error so you might need another Execute Process Task to delete a mapped drive if it already exists. We ended up with a batch script that would check to see if the mount existed. If it did, it would delete it first. Then it established the mount.
This batch script approach allowed the DBAs to secure the file with file system permissions. The job could access the batch script but we could not so they didn't have to worry about us having access to yet-another-account.
The other, far simpler approach is to not deal with mounting drives and instead just use the UNC path. Assuming you don't have to worry about presenting different credentials than the current user, it makes life much easier.
\\server\share\MyFile.123.txt

Flat File Source Failing When Deployed and Executed

I am trying to create a simple SSIS package that can be deployed to a VM on another domain (same computer) that has SSIS on it. The package that I have created will transfer data if I simply run the data flow from SSDT on the source computer, but when I try to deploy and execute it, it appears to have 2 errors. The first being that it cannot open the datafile "C:\SSIS\Product Data.txt". The second being that the Flat Files Source 1 failed the pre-execute phase. I think that the second error is caused from the first. Does anyone know how to create a package that can transfer data to another computer without the flat file source?
Thanks in advance!
C:\SSIS.... will refer to the local C drive of the computer that is executing the package. So if you have it on the VM it would be at the \VM\C$. Typically it means 1 of 2 things.
1) The file path is not correct and you are not referencing where the file actually is.
2) the user you are executing the package as does not have permission to that file.
So where is the file is it on the C drive of the machine you are executing the SSIS package on? The answer to that wasn't clear in your question.
Second how is the file being executed? manual execution such as DTS_Exec? SQL Agent? T-SQL? If manual then the user logged in executing the task must have permission, if SQL Agent then the sql agent service account and possible the sql server service account have to have permission to the file, and T-sql sql server service account needs to have permission.
When it is local file path then a local user or domain user will work for the service accounts. If network path then the local user used for service account won't work and you will need to setup a way to run as a different credential.

Sporadic errors when reading textfile from share

A service running under domain account starts 20 ssis packages one by one to read 20 textfiles on a share. One of the packages (always the "same" filename) fails sporadically: one or more successfull reads, then one or more failed reads, then one or more successful reads and so on.
This behavior used to happen for file A.csv but not anymore and the file B.csv is the current victim. When the job fails I run succsessfully all the unfinished packages manually using the same domain account as the service uses.
"
Error during execution of package ...
Connection B failed validation.
The file name \share\folder\B.csv specified in the connection was not valid.
The file name property is not valid. The file name is a device or contains invalid characters.
"
Internet search provides comments like privileges ons the share, folders on the path and the file it self. But I think that is not the problem because the domain account does have these privileges and the reads (through the service) are sometimes succsessfull.
Any help will be well received
regards Bernódus
Try using path for shared folder with IP for example \\10.150.0.1\sharedFolder\B.csv
or without IP as \\server\sharedFolder\B.csv
If it's fail-pass then check whether that file is used by any other process\user, since it's on share so there are chances.
One of the workarounds is to have the network path mapped to a drive on the host server of the package.
You have make UNC paths to work on the calling machine, the server or the destination machine.
It could be a permissions issue.
Check permission on shared folder for -
Your personal Windows login account
Windows account which is owner of the SSIS Service
We use to have a sporadic copy file to shared drive failure. Everything would be executing fine for about a few weeks or a month or so and then failed task with error on "Network path" or "login failure".
We found that the job was taking too long with one of the tasks and some how it was giving errors.
We had to modify the packages to improve performance to fix the problem.
Check your SQL Agent Job history to see if the tasks were taking a long time when the failure occurred.
Is there anyway to improve on the package performance or separate the package into multiple packages to run in SQL Agent one package after another
Hope the information helps.

mysql host on internet using hp cloud and xeround

I am new to the 'cloud' concept I have a Java based application for data entry which runs well on my LAN.
On my LAN I install:
MySql
Configure Instance ( user name - root, pass - ******)
Dump dummy database entry_db that is in raw format
Then I have a jar executable file which when runs, displays a login screen.
I manage to successfully log in using predefined ID and PASSWORD (user - config pass - ******)
After logging in I configure(d):
Database Type
Database IP
User Name (Root)
Password ****
Database Name ( It auto selects database named entry_db)
In another window I configure(d) Network File Sharing Location:
file shared location
image path
back up data path
config file location in xml
(Note - When I select file shared location, all other files take the same path automatically)
Then I create Admin account rather than Supervisor account or operator account and login with the Admin account and I can now upload data and distribute to all operators.
Here is my problem:
I configure a cloud computer on Hp Cloud (they provide me a static ip) and then import database from xeround.com.
I now have a dns and port number and also a log in form using MY PHP CLIENT
How can I package all this to the same executable jar file to be used from anywhere?
How can I use it just like on my LAN from the web?
What is the optimal configuration for this?
I work in Xeround.
I have read your question and I wanted to point out a couple of things; you should use the DNS in the connection string where you used to put hostname/IP of the MYSQL server machine and the port number where you used to put the MySQL default port (3306).
 
Other than that you can connect from anywhere there is access to the instance. I suggest that if your jar runs in the HP cloud you create your Xeround database instance there as well (this will yield improved performance).
 
If you still need help, we will be more than happy to help you. Just send us a quick email to support#xeround.com and we'll take it from there.
Cheers,
Yuval

error:failed retrieve data for this request

I need to attach my database to SQL server 2008(I used it before without problem),but now when I want to attach db , sqlsrv sent me this error.
error:failed retrieve data for this request.
Why do I have this problem and how can I solve it?
Please make sure that the SQL Server Service account has modify permissions over the physical mdf and ldf file on the hard drive that you are trying to attach to a SQL Server instance, and modify permissions also over the folder that contains the file