SqlException (0x80131904): Login failed for user 'DOMAIN\username' - sql-server

I have created an intranet site that is running fine locally but when running with IIS I am getting a SqlException (0x80131904): Login failed for user 'DOMAIN\username' message. Not sure if it matters or not but I am remotely connecting the server from a different location.
I was hesitant to post as I am quite new to programming and feared looking silly but I have searched for days and days looking for a way to fix this. I have checked Windows authentication over and over as well as windows authorization.
Note: When logging in for windows authentication, If I enter the incorrect user details, the window appears again, if user details correct I can access the site. I can then navigate my way around the site until a point required to access the database. Looking forward to a resolution. Currently pulling my hair out.
Can supply code if requried

Related

Error establishing a database connection on wordpress sometimes

i have a blog with wordpress but sometimes i have problem with that
i got blow error
« Error establishing a database connection This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at %s. This could mean your host's database server is down.
Are you sure you have the correct username and password? Are you sure that you have typed the correct hostname? Are you sure that the database server is running? If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums »
by searching the internet some say that it can come from the database connection information but my concern in my case is that it only happens occasionally and if I wait 5 minutes and I refresh again, the site works again correctly, then if I wait a few hours and I try to reconnect the problem comes back again… it happens in my back end and my front end, I have searched in vain I can't find anything in my case please please help friends, here is the URL of the site:
(https://www.creationsjennah.fr/) host is 1&1 IONOS : offer web hosting option in business plan
I would like to remind you that I am probably the only one to use the site, it is in the test phase in an online environment, I see it in the statistics of my site.

Wordpress website db connection error

I came over this serious problem.
My WordPress website was running all right. suddenly It showed the page of WordPress installation. so, I quickly registered a user and so on. Then it showed "db connection error". I went to my server and tried to log into my phpmyadmin but the password didn't work. This kept happening for 5 mins. then thing worked normal again.
1- is this a hacker attack?
2- how do I prevent the page of WP installation from showing up if the db connection goes down again? because this is a desaster
how do I prevent wp-admin from showing the name of my db in the db connection error ? Better preventing any error report from my website when anything is down?
thanks
Nobody can tell you whether it was hacker related without a lot more information. There should be logs on the machine hosting your site--I would check them first to see if you can tell if the database went down and why. If you don't admin your own site you can ask your hosting provider what the problem was--they may have been rebooting a database machine, for example.
I would also do a full backup of your site and database in case there is any hardware trouble you don't know about.
In the meantime, if you administer the site yourself, take a look at advice for hardening Wordpress: http://codex.wordpress.org/Hardening_WordPress

SQL Server error log entry : Error: 17806, Severity: 20, State: 14

I have error in my log for a few weeks, I searched a lot but I couldn't found useful answer.
I did close SQL Server port for public IP, But I have problem yet.
Error: 17806, Severity: 20, State: 14.
SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. The logon attempt failed [CLIENT: 10.10.3.25]
Time raised: 27 Jan 2015 2:23 PM
It was raised error while this system was off.
The Scenario –
A couple of separate individual Windows ID’s started generating these errors while attempting connections, all other windows logins were working properly. The connections were initially happening through applications, but also occurred through sqlcmd. When logged in to the server locally with the offending ID’s the connections to SQL would succeed.
The Troubleshooting process –
Check all the regular SSPI issues, I wont bore you with the details as they are easily searchable
A relatively easy way of checking the “easy” authentication issues If possible/appropriate is to log into the SQL Server locally with the offending ID and fire up sqlcmd and connect to the server via sqlcmd –Sservername,port –E (by specifying the port you force TCP/IP instead of LPC, thereby forcing the network into the equation)
Verify whether the login is trying to use NTLM or Kerberos (many ways to do this but simplest is to see if there are any other KERBEROS connections on the machine)
SELECT DISTINCT auth_scheme FROM sys.dm_exec_connections
If Kerberos is in use, there are a few additional things to verify related to SPN’s, since only NTLM was in use on this server I skipped that
Determine if the accounts were excluded from connecting to the machine through the network through a group policy or some other AD setting
After all of these checked out OK, I began to try and figure out what the error code 0x8009030c meant, turns out, its fairly obvious what the description is : sec_e_logon_denied. This description was so helpful I thought about making this server into a boat anchor but, luckily for my employer the server room is located many miles away and has armed guards.
Since I knew we could logon locally to the SQL Server with the ID that SQL was rejecting with logon denied something else was trying to make my life miserable.
We didn’t have logon failure security auditing turned on so, I had no way of getting a better error description, As luck would have it though this would prove instrumental in finding the root cause. To get a better error message, I found this handy KB article detailing steps needed to put net logon into debug mode.
Say hello to my new best friend! — nltest.exe
After downloading nltest & using it to enable netlogon debugging on the SQL Server, I got this slightly better message in the netlogon.log file
06/15 14:15:39 [LOGON] SamLogon: Network logon of DOMAIN\USER from Laptop Entered
06/15 14:15:39 [CRITICAL] NlPrintRpcDebug: Couldn’t get EEInfo for I_NetLogonSamLogonEx: 1761 (may be legitimate for 0xc0000064)
06/15 14:15:39 [LOGON] SamLogon: Network logon of DOMAIN\USER from Laptop Returns 0xC0000064
The error code 0XC0000064 maps to “NO_SUCH_USER”
Since I was currently logged in to the server with the ID that was returning no such user, something else was obviously wrong, and luckily at this point I knew it wasn’t SQL.
Running “set log” on the server revealed that a local DC (call it DC1) was servicing the local logon request.
After asking our AD guys about DC1 and its synchronization status, as well as whether the user actually existed there, everything still looked OK.
After looking around a bit more I discovered this gem of a command for nltest to determine which DC will handle a logon request
C:\>nltest /whowill:Domain Account
[16:32:45] Mail message 0 sent successfully (\MAILSLOT\NET\GETDC579)
[16:32:45] Response 0: DC2 D:Domain A:Account (Act found)
The command completed successfully
Even though this command returned “act found” it was returning from DC2. (I dont exactly understand why the same account would authenticate against 2 different DC’s based on a local desktop login or a SQL login but it apparently can)
After asking the AD guys about DC2 the light bulbs apparently went off for them as that server actually exists behind a different set of firewalls, in a totally different location. While DC2 would return a ping, the console wouldn’t allow logons for some reason. After a quick reboot of DC2, and some magic AD pixie dust (I am not an AD admin, if it wasn’t totally obvious from my newfound friend nltest) the windows Id’s that were having trouble started authenticating against DC3 and our SSPI errors went away.
Interesting tidbit — During troubleshooting, I found that this particular SQL Server was authenticating accounts against at least 5 different DC’s. Some of this might be expected since there are different domains at play but, I haven’t heard a final answer from the AD guys about whether it should work that way.
The solution
Reboot the misbehaving DC, of course there may be other ways to fix this by redirecting requests to a different DC without a reboot but, since it was misbehaving anyway, and the AD experts wanted to reboot so we went with that. A reboot of SQL would have likely solved this problem too but, I hate reboot fixes of issues, they always seem to come back!
reference

Login failed for user 'sa' while trying to create datasource with Railo

So I'm trying to setup Railo and I want to add a datasource.
For the database I'm using Microsoft SQL server Management Studio.
But now I've run into the classical problem: "Login failed for user 'sa'. ClientConnectionId:afd80ac2-0744-4a7d-a9f7-083d93adee0d"
What I've done so far:
With the SQL Server Configuration Manager in the TCP/IP settings I enabled the IPs I had to.
I set the password for the user 'sa' in MSSQL and I added a user mapping for the table I want to use.
I made the user 'sa' the owner of the DB i want to connect to
Restarted the SQL service, my computer and Railo multiple times.
I'm pretty much out of ideas.
After Leigh mentioned in the comments to look at my logs it had the following message: "Login failed for user 'max'. Reason: Failed to open the explicitly specified database 'test'. [CLIENT: 127.0.0.1]"
I then tried to make a connection without mentioning a database and that worked.
I would also point to Leigh's answer here which explains how to turn Mixed-Mode authentication on, as this can also cause this error. Since the cause of this isn't on Railo/Lucee's end, this issue still arises in 2018.
I just don't want a useful answer to get lost to history, nor plagiarize an answer I barely found.

MVC local dev The underlying provider failed on open - Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' in Firefox only

I've noticed a number of similar topics but none of them either solved the issue or had quite the same circumstances so I figured I'd post the issue and then answer it to help anybody else.
IE/Chrome had no issue but in Firefox when accessing pages of my mvc intranet project running locally to dev test those pages that access my sql database, I would get the error 'The underlying provider failed on Open' which with debugging it told me 'Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
In most cases this seems to not be browser specific and was generally an issue with the connection string to the db, I had found a perfect question which listed most of the likely issues but can't find it now so if I do I'll link that.
As far as I could see my issue was to do with double hopping from my machine to iis then to the database and it lost my credentials in firefox at some point.
While most solutions to this indicated that you needed to set or add Integrated Security=True; to the connection string among other possible solutions.
I first found that if I set impersonate to true and passed in my own domain username and password that it fixed it but this was a bad solution as it required me to store my details.
The actual solution which solved this particular problem with least possible issues was to set impersonate to false and bam no further issues.
This is a database connection problem, not a browser problem, check that the sql service is opened, check also if your connection string is valid, you can post your code.

Resources