I have an application that is running an calls a stored procedure. This application works fine on another PC connecting to a database, but not on localhost. The database was backed up and restored on my dev computer. The source code is exactly the same thus there is no naming/typo error.
When I run the app, I get this error:
System.Data.SqlClient.SqlException: Could not find stored procedure 'xyz'.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
I know the application is connecting to the database properly as it has already logged into the database.
What I have tried:
grant all permissions to the db_user(I have made the db_user the owner of the database and granted all permissions of the stored procedure to the user)
ran aspnet_regiis to configure the application on the SQL Server.
However, it seems like I am still getting the error.
Any advise will be greatly appreciated. I have googled the rest of the similar could not find stored procedure on stackoverflow, but none of the resolutions worked.
Related
I'm facing a situation which every 10 seconds an error log is recorded with the following msg:
2018-07-25 09:07:09.59 Logon Error: 18456, Severity: 14, State: 38.
2018-07-25 09:07:09.59 Logon Login failed for user 'svc_sql'. Reason: Failed to open the explicitly specified database 'ReportServer'. [CLIENT: <local machine>]
In my instance I don't have a 'ReportServer' database. I know that in the past the server was migrated to a new machine and I reckon the 'ReportServer' database was created with a new name in the new server. I really don't know how the migration was done.
I've activated the SQL_Profiler with all audit options and I could see that this user also executes a procedure sometimes.
I've checked the default database for this user and it's Master.
Any ideas how can I fix this issue? My error log is flooding with this message.
Thanks a lot.
Rod
I've checked the default database for this user and it's Master.
The error doesn't tell you about default database but about explicitly specified database, that is different, it's the database that is mentioned in connection string under Initial Catalog or Database.
Do you see what application tries to open this database? The problem is in that application, it uses old connection string. If it's SSMS, it's simple, it's in the Options of connection dialog, but if it's another application, the connection string can be written in the ini file or hardcoded.
I don't know if I try to run DBCC CHECKDB master will solve this.
Of course it cannot solve this. This has nothing to do with database integrity. It's your client that uses wrong connection string.
Any ideas how can I fix this issue? My error log is flooding with this
message.
If you just want to save your errorlog from these messages just turn off failed logins audit:
Or you should find this application by its name or host or client address.
Or you can temporarily disable this login and see who will call you saying he cannot login anymore, or, if it's your local machine, some of your applications will fail, this way you'll find it.
I had the same error and doing the following resolved the error for me:
From within the SQL Server Management Studio
Security
Logins
Right Click the user ID that was failing login
Server Roles
Make sure all the checkboxes are checked. Right clicked Security and refresh.
I have an SSIS Package that runs via a SQL job on a SSIS server (Server A) that executes a stored procedure on the database server (server B). This stored procedure does a Bulk insert from a file share that is located on the SSIS Server (Server A). However, every time that the stored procedure runs it fails with the follow error:
Execute Membership Process:Error: Executing the query "exec storedprocname ?, ?" failed with the following error: "Cannot bulk load because the file "\ServerA\TestLoads\Membership\Processing\filename.csv" could not be opened. Operating system error code 5(Access is denied.).". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
I am pretty positive that the issue is related to permissions. If I store the files on the database server (Server B) then it processes. Or if I run the proc manually, it will work.
When I execute the job on Server A it executes as the service account for that server. That account has full access to Server A and Server B (Admin in SQL and on the server). I believe what is happening is the credentials get passed the first time, but they are not continued once the stored proc runs. I ran wireshark on Server A (SSIS Server) so that I could see what was access the share and try to get some more information. What I found was that there was no account information being passed, it was just blank.
I went through a lot of steps just to try to see if could get that work such as granting everyone access to the share, enabling the guest account, allowing anonymous users, etc. Not stuff I would want to do, but trying to narrow down the issue. None of those worked.
I tried modify the stored proc to use WITH EXECUTE AS OWNER. Still did not work, but got a different error. Also tried a variety of other accounts to execute as and got the same error each time.
Execute Membership Process:Error: Executing the query "exec [storedprocname] ?, ?" failed with the following error: "Could not obtain information about Windows NT group/user '', error code 0x5.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Tried a variety of solutions that I found online to get this to work and nothing so far has done it.
I understand that is not an ideal solution. I was under the impression that the developers where using SSIS to load the file initially and then using SQL for the rest of the process which would have worked. But because SQL has to touch the file system it keeps failing. And at this stage, there is not the option of rewriting this. Additionally, this process will work if we move the files to the database server (Server B), but that eliminates a large need for us in having the SSIS server in the first place which was to get files being processed off of the database server
Any ideas on if there is a way to get the current solution to work? Basically, what I think I am needing is to run the SSIS package and for a way to pass credentials via the stored proc to the file share during that process.
We are using Windows Server 2012 R2 on both servers and SQL Server 2012 sp3 Developer edition.
Thanks for the help!
I've had this issue before, and I still don't fully understand Kerberos authentication, but that fixed it for me. It's something to do with "double-hop" of authentication i.e. creds going from SSIS, through SQL Server, to a network Server.
Try setting up Kerberos Authentication for SQL Server. There are detailed step-by-step instructions with screenshots here => Setup Kerberos Authentication for SQL Server
I understand this is like a "link-only" answer, but I don't want to copy-paste & plagiarize the author's original works i.e. blog post, hence the link.
I wrote an app and I am trying upload it on Azure. The app runs ok locally and has a SQL Server database as the backend; the app is based off MVC.
When I try to access a page such as /person, I get this error:
Azure Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'null'.
Anyone ever dealt with such an error and how did you resolve it.
I have tried a few suggestions but none seems to work:
adding to config file
setting Persist Security Info=False to true
What is the best way to solve this?
On the app's data connection, the connection string had no userid. Adding a userid fixed the issue. Even though when the app was published with a proper connection string, the user id was empty.
In a DNN page containing ANYTHING that accesses custom data (i.e., site-specific tables), we always get the following error:
Access Is Denied
[Win32Exception (0x80004005): Access is denied] [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.
Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +6749670 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +815
Current config:
IIS pool set up as a local service
SQL runs as a localsystem service
All of the users have the proper DB ownership
DB can be accessed OK for the main DNN install (i.e. users can log in and all DNN-related database infrastructure can be read and displayed from the database), but for the custom modules that read the Connection string from the web.config, it throws the error above.
We've tried to:
Change to poolidentity and give the permission to that particular user/service, and we are experiencing the same problem.
I'm not sure if IIS Application Pools or SQL users are the issue. The error seems to be about the SQL instance which may or may not be set up correctly. However, if it's an SQL instance issue, as per the error message, we are not sure why database access for DNN functions (login, tabs, modules, etc.) are allowed but other connections (via LINQ data context for site-specific schema, or via where we hard-code the connection string) are denied.
I have just installed a fresh instance of SubText via the Web installer, I can open the new site up, login to the http:///HostAdmin no problem, but when I login to http:///Admin I get the error:
The EXECUTE permission was denied on
the object 'subtext_GetBlogStats',
database 'subtext', schema 'dbo'.
I could just open the database up to allow the user to have all permissions, but that's kinda crappy, I could add the permission to the single stored procedure, but then I don't know what other permissions might not be set right.
What database permissions should have been set for a correct subtext installation?
I'm not exactly sure if this should be asked here, on serverfault.com or on webapps.stackexchange.com, so sorry if it's in the wrong place.
I'm Simone, member of the subtext team.
I know this problem happens from time to time.
The SQL Script that grants permission to the SPs is correct, and in fact most of the times the permissions are set correctly.
Setting the permissions to that SP will fix your problem.
Let me know if you have any other problem
Simone