I have trouble accessing filestream via SqlFileStream. Sql server and IIS7 are on different servers, remote access to Filestream is enabled. Workgroup for both servers is the same.
I've tried everything, including opening user with identical username/passwords on both servers. Didn't work.
Dim sqlFileStream As New SqlTypes.SqlFileStream(filePath, txContext, IO.FileAccess.Read)
I have both filePath and context.
However, when I open server via explorer logged on locally as Administrator, I also get access denied if I try to acesss this share. Any ideas?
Can permissions for this share be edited at all?
The solution to this problem is to have user with same credentials on both sql server machine and IIS machine. Also, application pool identity must be running with these credentials, and connection string must be set to integrated security.
To edit permissions for this share you edit permissions on this table, as the documentation clearly states (funny how this clearly comes to you only after tenth time reading it):
In SQL Server, FILESTREAM data is secured just like other data is secured: by granting permissions at the table or column levels. If a user has permission to the FILESTREAM column in a table, the user can open the associated files.
"Integrated Security = True;" in connection string
Related
Ok, one physical server running Hyper-V. One VM is for the SQL 2016 DB. Another VM is for the web based application that talks to the DB. A third VM that is used as the file server. All files are stored on the file server.
The file location that needs to be bulk inserted is shared with the DB Service Accounts (currently set to specifically made domain accounts - one for each service).
The file can't be imported - access is denied. I've tried setting the share to Everyone - still doesn't work. I even changed the Security Policy to allow Anonymous users the same permissions as Everyone - still doesn't work.
I don't know how to go about this Delegation method so not sure what to do there.
What else can I do to get a simple file to import into a DB?
Have you enabled kerberos? If the connection is coming in as Anonymous, dosent it mean that the connection is using NTLM and its a double hop issue?
I am trying to share a file containing a table of information pulled from an external SQL query connection. It works fine for me as I have the connections set up on my PC but when I send the file out, it asks for connection credentials. I could go to each PC and enter the credentials but would prefer the end users to open up the file and use it without having to enter any credentials and would like them to be able to refresh the data as and when needed.
How would I set this up or is it even possible?
Thanks in advance.
Your connection string should be using Windows Authentication, and the local user must be a member of a domain group that has the privileges to run the query on SQL Server.
If you go to Connection Properties, open the connection, and click on Definition, the Integrated Security tag should be set to SSPI.
The Plan
Have HR personnel dump an Excel file of payroll Job Titles to a network share, add that file as a Linked Server in SSMS, use those titles in my ASP.Net web forms. Using a Linked Server instead of importing data to allow HR to update the Job Titles file at their discretion.
The Problem
I can create the Linked Server and query it without issue, so long as I'm in SSMS with Windows Authentication. But, if I try to access the linked server using a SQL account, I first get the error:
Access to the remote server is denied because no login-mapping exists (Error 7416)
The SQL account being used is the same account my web forms use for everything else. The fact that this SQL account doesn't have file permissions isn't surprising though, so an adjustment to the Linked Server's security should do the trick.
The Problem (part 2)
To reduce the number of variables, I moved the Excel file so it's on the same machine as my SQL Server. I'm logged into the machine and logged into SSMS with my domain admin account.
I access the Linked Server's security tab and, to try and cast the widest net possible, I leave the local login (top part) blank and head straight to "Be made with this security context:" and proceed to provide my domain admin credentials. I hit OK, and I get the following:
Not a valid account name or password (Error 7399)
I know the account name and password are good, so what gives?
Other Things
Folks who've ran into similar things have been instructed to change the logon account being used for the SQL Server service, which I've done using my domain admin account (for troubleshooting, atm). This did not fix the problem.
This is what the Linked Server code looks like, although I created it via the GUI (included for sake of completeness):
EXEC master.dbo.sp_addlinkedserver #server = N'ADP_TITLES', #srvproduct=N'', #provider=N'Microsoft.ACE.OLEDB.12.0', #datasrc=N'C:\JOB_TITLE_EXPORT.xlsx', #provstr=N'Excel 12.0 Xml'
EXEC master.dbo.sp_addlinkedsrvlogin #rmtsrvname=N'ADP_TITLES',#useself=N'False',#locallogin=NULL,#rmtuser=N'DOMAIN\username',#rmtpassword='########'
The solution appears to be entering "admin" for the remote login, and leave the password blank.
This only works, however, if the file is stored locally. If it's on the network, I still get a 7399 error, but instead of saying the issue is the account name/password, it now says the issue is unspecified.
I can make my project work with a local file though. Since I'll be moving forward with that, I have no need to solicit additional answers.
I use Microsoft Visual Studio Professional 2013. I created Database1.mdf in my App_Data folder. By default, it uses integrated Windows authentication. I have no problem connect to this database file, but when I update all file into web space and browse it in browser, it has an error. I think I need to change it to SQL Server authentication instead of integrated Windows authentication.
My questions are:
How can I change it to SQL Server authentication step by step? I want to connect this data file with user name & password.
How to assign user into it?
You need to attach the database file to your SQL Server:
http://www.youtube.com/watch?v=rhIr9Qf-oHw
Then you create the type of logins you want:
http://www.youtube.com/watch?v=Uh5USR7pymE
You can now detach the database. Your application can use now the new logins. If you change from Windows to User/password your connection will need to say so, something like:
Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;
I also found this helpful link that describes also the steps:
SQLExpress - How do I set username/password for a sql datafile
Hope this helps.
I am in support of a database driven windows application wherein the data may come from local or remote system (depending on some configuration files).
Currently MS ACCESS Database is being used.
Application runs smoothly when connected to local database.
But when trying to connect to a remote PC Which is password protected,i am getting the
following error
"The Microsoft Jet database engine cannot open the file '\\\XXX.XXX.X.X \ YYYY \ ZZZ.mdb'. It is already opened exclusively by another user, or you need permission to view its data.
i am providing the credentials for database in the connection string as below.
pConObj.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pAppPath & "\zzzz.mdb;Persist Security Info=True;Jet OLEDB:Database Password=ppp"
The Remote database resides in a shared folder in remote pc which has read/write permissions for everyone user group
following is the format of remote path (pAppPath VALUE in above connection string)
\REMOTE IP ADDRESS\SHARE FOLDER NAME
Please let me know how can i supply remote pc credentials?? or is there anything i am missing here.
PS:If the remote pc do not have user name and password i am able to connect to remote dabase.
Thanks in advance.
Security wise approach:
You need to connect with a user that has access to the remote pc.
Assign the user you are connecting with both Share permissions and security permissions on the shared folder.
Not good for security approach:
Assigning Full control permissions for Everyone is not good for security reasons. But if you prefer so, just verify that you allowed full control permissions on folder security and folder share permissions.
Ok, i got it working now.
What i learnt from microsoft articles is whenever we try to access resources on a remote
computer,corresponding network connections are mapped to Guest account on the remote pc.
So,in my case guest account was not added in the list of allowed users for the shared folder.
I added the guest account in permissions list and it worked.:-)