Login Failed on SQL Server 2014 - sql-server

I'm having issues connecting to a SQL Server 2014 database using Management Studio with SQL Authentication. This server was just created by my IT department. I restored a database, I added the login with a password, I made sure the server properties had both SQL Authentication and Windows Authentication checked. I made sure the user at the database level is mapped to the login. But when I try to connect using Management Studio I get the following error. However, it works if I use my Windows Authentication account.
Actually, I kept getting the normal 'Login Failed' message. But this morning I got the above error which is probably more helpful. When I kept trying again, I kept getting the normal Login Failed message.

Have you seen this Microsoft TechNet post about the message you received? It looks like your admin may need to adjust the SQL Server configuration.
Specifically, it looks like you might need to try one of:
Connect using TCP/IP, or use the SQL Server Configuration Manager to
enable remote connections using named pipes.
or...
Using SQL Server Configuration Manager on the client computer, move
TCP before named pipes in the protocol order list.

Related

Connecting to SQL from Bamboo still throws error Login failed for user

I am attempting to connect my Bamboo instance to SQL Server, but I am unable to do so because of the error Login failed for user 'Bamboo'. Investigation into the log files shown in the location
C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG
throws an error that I should not be getting at this stage of my attempted login. Server is configured for Windows authentication only. Currently able to login using same SQL Server credentials to access the database, just not via Bamboo.
The reason why this should not happen is because my server is already set up to do so, and I will list all of the steps that I have taken to prevent this error. In my localhost SQLEXPRESS server I have checked SQL Server and Windows Authentication mode. Once I restarted SQL Server, this worked as I was able to log in with the credentials that I added to a user called Bamboo.
The user I added is mapped to the database called BambooDatabase as a db_owner. The number of concurrent users is unlimited and I have tried disconnecting from SQL Server just to check if that was a problem, but still no difference. I added 2 more users with connect access and mapped to BambooDatabase.
I have went to the SQL Sever Configuration Manager and enabled TCP/IP and made sure that the IP addresses was pointing to 1433. And then configured my firewall to all access to 1433 as well. The fact that my error logs for SQL Server are appearing makes this seem that everything should be fine here. So with tested 3 users on SQL credentials everyone logged in successfully and all have the relevant permissions needed. All three gave the same error when trying to connect from Bamboo.
I am trying to connect to Bamboo like this:
Direct JDBC connection.
Driver class name: net.source.jtds.jdbc.Driver
Database URL: jdbc:jtds:sqlserver://localhost:1433;DatabaseName=BambooDatabase
User name: Bamboo
Password: SQL Server password
Checked overwrite existing data
Then once I click continue the log in error throws. Have I missed something here, I cannot see what I could do differently, I have tried to connect to SQL Server from Bamboo several different ways but have had no success. I am using SQL Server Express and the Bamboo version 5.11.3, I am testing upgrading from 5.11.3 to 5.15 with larges amounts of data which is why I am using that version.
Error from Bamboo is:
Error accessing database: java.sql.SQLException: Login failed for user 'Bamboo'.
Error from SQL logs is:
Login failed for user 'Bamboo' Reason: An attempt to login using SQL authentication failed. Server is configured for Windows authentication only. [CLIENT: 127.0.0.1]
Are you running Bamboo en SQLExpress on the same machine? If not, you should look into the remote access configuration.
In the SQL Sever Configuration Manager, make sure that you entered 1433 for the IPAll entry as well. And start the SQL Browser service for good measure, this is especially important when using a names instance, but going after the errorlog folder you copy/pasted, that's not the case.
For testing purposes, you might want to disable the firewall all together and reactivate is after you get the connection up.
Another thing to try if you're connecting on the same machine, is use the loopback address 127.0.0.1 instead of the localhost alias.

Cannot connect to SQL Server 2008 R2 with Management studio

Today I get this strange exception:
Error HRESULT E_FAIL has been returned from a call to a COM component. (mscorlib)
I cannot connect to my database! Tool started under admin rights.
Services:
I am not sure if disabling firewall is enough. if the user has sysadmin permissions and still getting this error means client is not able to connect to server in debugging mode. check this TCP and UDP ports are correctly open.
SQL remote debugging configuration
EDIT:1
I am sure you must have also googled a lot and tried to find out about the error messages. What I have found so far is the Error in the OP you mentioned is misleading and from that error, we cannot tell what exactly is wrong or what to look next. But as you replied in the comments, after making changes to enable Remote Debugger; the mentioned error is more clear and I feel that proper permission is still an issue. Plenty of other suggestion you also might have tried so far, but if you haven’t done this, let's try one more time:
In one of the comments, I mentioned you to try login using the windows user.
Now Keep the settings you already did for TCP ports, Firewall Exception etc… explained in the above link. you have windows 2012 server where you installed DB server. and windows 8 Prof where you have DB client and you connecting through SSMS. Now I believe both machines are in the same domain. Let’s say domain XYZ. You must have windows login on the server, let’s say it is “XYZ\HALI” using which you can login to the Windows Server. log in and make sure that login also exists in SQL SERVER with sysadmin permission. Because client machine is also in same domain make sure you have logged in into the client machine using same user “XYZ\HALI”. Now start SSMS and choose windows authentication instead of SQL SERVER authentication. Try to start Debugging T-SQL code now.
if client and server machines are not in same domain then we have to register server name on client machine as Linked Server, impersonate the login/user as local and then try the debugging.
Edit:2
Login to SSMS using Windows Authentication

Error while trying to connect to SQL Server - localhost

I have checked the instance name, auto close is set to true, allow remote connections on the server is checked. The server is running when I open the SQL Server configuration manager. I have even rebooted. I have created this db the same way as all others. I use Entity Framework and have checked the names in the web.config and they match. This is the default connection string from the wizard - I use for testing before I deploy. I just can't think of anything else to check to figure out why it won't connect. Working inside SQL Server everything is fine.
Here is the general error.
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: Shared >Memory Provider, error: 40 - Could not open a connection to SQL Server)
Config:
connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string='data source=.\SQL_1;attachdbfilename="C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.SQL_1\MSSQL\DATA\A_db.mdf";integrated security=True;connect timeout=10;user instance=True;multipleactiveresultsets=True;App=EntityFramework'" providerName="System.Data.EntityClient" />
Thanks in advance.
Let me preface this answer by saying that proper setup of a SQL instance is not as easy as Microsoft would like you to think with the entity framework. It's a little bit involved and requires that you put your DBA hat on for a little bit.
The error you have indicates that the web instance is attempting to connect to the SQL server using Windows Integrated Security. This will work fine if (a) the windows user that the process is running as (which can be configured in IIS) is authorized to log on to the SQL server and has a valid login in the database and (b) if the SQL server is on the same machine or in the same domain as the IIS server.
In light of this, I recommend using SQL Server authentication. If you need to know how to do this, I recommend searching for "SQL Server Authentication setup" - here is an article that I found which might help you set this up.
http://msdn.microsoft.com/en-us/library/aa337562.aspx
In general, I recommend taking the following actions:
Connect to the sql server using MS SQL Management Studio.
Permanently attach your database, then use the Initial Catalog property on your connection string rather than AttachDbFileName
Then set up your login username and password on the SQL server, and create a login in the database for it.
Make sure your login can only execute the stored procedures you want it to execute. Deny it access to running sql statements.
You will also need to add the username and password to your connection string, and set IntegratedSecurity=false.
Let us know how things go once you get your SQL server set up properly.
This error means that your provider code cannot find the SQL Server. If you have checked the server instance name (it should be <yourLocalServer>\SQL_1), then it could be the attachdbfilename= parameter, as this is a really unreliable way to specify the database to connect to (you should be using the Database Name, not the file name), because there are about a hundred reasons that the file name could change that have nothing to do with your application.

Error connecting to SQL Server using SQL Server Management Studio

I've been trying to connect to SQL Server using SQL Server Management Studio to no avail.
This is what the error says:
Cannot connect to .\HAMED.
ADDITIONAL INFORMATION:
Login failed for user 'HAMED'. (Microsoft SQL Server, Error: 18456)
I have an instance of SQL Server by the name of Hamed which is run in Network Sevice mode. I'm using Windows 7.
I'm guessing you didn't grant yourself SQL admin during the install, but are you sure the DB instance is "HAMED"? That sounds like the machine name. Try connecting to .\sqlexpress
Do you remember the SA password? If so, you can add yourself by logging in with that account. Otherwise, you'll have to jump through some hoops and loops to get yourself added.
If you forgot to add yourself to the SQL admin group, read this article:
http://blogs.ameriteach.com/chris-randall/2009/12/11/sql-server-2008-forgot-to-add-an-administrator-account.html
It looks like you're trying to use "SQL Server Authentication" in the login dialog in SSMS, but the user that you're trying to use is a Windows user/administrator? If so, the fix should be as simple as choosing "Windows Authentication" in the drop-down.
UPDATE: looks like I jumped the gun - this sql server forum thread lists lots of possible issues, including permissions issues, orphan users, etc.
sa... the answer was sa.
I had set the administrative password but didn't know the username to go with it. Very nube, I know, you can hit me with it later.
When I installed SQL it asked me to set administrative password - right now SSMS can login.
Under users I see 1\cory (1 is my machine name - I'm trying a numbering scheme). But if I type that in it fails with the error. SQL says "no, that's an NT login, I can't use those".
Under the users list SQL does in fact show the user as Windows authentication but as I said - for some reason I can't connect using Windows authentication. The connection times out.
I'll just add a direct user name here.
All this is to do the MSVA courses for SQL certification. First exam: get sql SSMS to work.

Can't connect to SQL Server Express anymore

I think I made a mistake and I lost my connection to my SQL Server Express.
In SQL Server Management Studio under security I disabled the login option.
Now when I try to connect to the Server I get the message :
"Cannot connect to
HP16969\SQLEXPRESS". Additional
informations : Login failed for user
'HP16969\Bernard (Microsoft SQL
Server, error : 18456)
Is there a way I can correct my earlier mistake ?
Thanks
I really have tried everything but can't connect anymore to SQLEXPRESS. Just because I change The login status to Disabled there seems to be no way for me to reconnect. That is silly!!
I followed the instructions including -m; in the parameter list without any success.
The last option I would like to use is to reinstall Server EXPRESS .After reading many articles on the net I am scared to run into problems...
You need to connect using a login that has access and grant yourself again access back.
If you don't have any login that has access, then you need to restart the server in administrative mode and use a local administrator account to enable back the account 'HP16969\Bernard'. See Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out.

Resources