SQL Server error 18456 [duplicate] - sql

This question already has answers here:
Login failed for user (Microsoft SQL Server, Error:18456) SQL Server 2005
(2 answers)
Closed 6 years ago.
windows unable to connect to SQL server with windows authentication mode I haven't created SQL authentication.Server name is AYAZ .Server is able to connect with Analysis and Reporting service but unable to connect with Database engine

Here is another suggestion:
SQL Server allows only SQL logins in the SQL Authentication mode. The logins are defined within SQL Server.
In short, if you want to use Window account to connect to SQL Server, connection string should not have user name and password. It would be something like below. Instead of username and password, we need to use “Integrated Security=SSPI”
Provider=SQLNCLI11.1;Data Source=SQLSERVER2016;Integrated Security=SSPI
For additional information: http://blog.sqlauthority.com/2016/02/17/sql-server-fix-error-18456-severity-14-state-6-login-failed-for-user/

Follow the below steps described here
Logon as a local administrator.
Stop the "SQL Server" service and run "C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Binn\sqlservr.exe" -m" (start SQL
Server in Local Only mode.)
Logon to SSMS from the server itself - no password required.
Add my own domain account as a Login, with sysadm server role.
Restart the SQL Server service

Related

Microsoft SQL Server Error: 18456 + windows authentication

My PC name is IBALL1. I get an error
Login Failed for user 'iball1\User1'.(Microsoft SQL server, Error: 18456)
I am trying to log in using Windows authentication.
And in SQL Server Configuration Manager > SQl Server Service > SQL Server Logon As Local System.
In error log text file, at C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log
Log says:
Login failed for user 'iball1\User1'. Reason: Could not find a login matching the name provided. [CLIENT: local machine]
i have also faced same problem then i have followed this intructions
Try this once other wise will look into other solution
Go to SQL Server Configuration Manager
Start->all program->SQL Server 2008 R2->Configuration Tools->SQL Server Configuration Manager
Explore "SQL Server Network Configuration" and then select "Protocols For MSSQLSERVER".
Check your TCP/IP Protocols in right side pane. If it is disabled then enabled it and Restart the "Sql Server(MSSQLSERVER) service" that available in "SQL Server 2008 R2 services pane".
Couple of check points:
1) make sure your your sql express services is up and running with name 'IBALL1'
if not try restarting.
2) while connecting give pc name as prefix for server name too .

Connection string failing for SQL server 2012

I'm trying to connect to my db on my local machine with the following connection string and it fails for the following connection string
conn = new SqlConnection("Server=(local);DataBase=dnn6;Integrated Security=SSPI");
I'm using IIS 6 as my web server and when I open that page I get the following error.
Cannot open database "dnn6" requested by the login. The login failed.
Login failed for user 'IIS APPPOOL\demo'.
I'm using SQL Server 2012
The problem is that the IIS account being used to access SQL Server (IIS APPPOOL\demo) does not have access to it.
You need to either:
grant permission for the user IIS APPPOOL\demo to your SQL Server
use impersonation to connect to SQL Server with a user account that has access
use SQL Server Logins to access SQL Server using a named user (not recommended these days)

Connecting access 2007 to sql server 2012

I've linked to a table in an sql server 2012 database using an odbc connection. This was straightforward and worked fine using my log in. When I attempted to open the linked table on another users computer I got an error saying I could not connect. I tried to set up the connection on their PC but couldn't see the database on the server. I logged on to sql server and gave that user a log on to the sql and access to the database using windows log in.
I still could not gain access to the database through access. Any idea what I'm doing wrong.
One Idea, you shall create all linked tables with a privileged user account of the SQL Server.
For example, if you enabled Trusted_Connection in the SQL Server, you can use the administrator's account of Windows, for example, johndoe2 for connection. If your SQL Server is installed on the LAN host masterserver, a linked table can be created as this:
ODBC;DRIVER=SQL Server;SERVER=masterserver\SQLEXPRESS;Database=[MyDatabase];UID=johndoe2;Trusted_Connection=Yes;TABLE=dbo.[MyTable]
In our case we can access MyTable throuhg Access 2007 on the host biomas that is on the same LAN as the masterserver.

Cannot connect to sql server 2008 using JDBC

I have tried all the methods to connect to the server.I am using sql server 2008 on mixed authentication mode.I can login via the sql server management studio using the sa login.But when I try accessing the same db from my java program I get the following error:
SQL Exception: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId:191d94bb-a55e-47a0-bb9f-b84638313cf4
This is my connectionstring:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String connectionUrl= "jdbc:sqlserver://localhost;databaseName=Northwind;user=sa;password=sa;";
I have accessed my database in the same way. One of my problems were that I hadn't enabled the port and IP for the database. Check these options in SQL Server Configuration Manager. Hope this helps =)

SQL Server 2008 erroneously returning SQL Authentication failed

I am attempting to connect to SQL via SQL authentication. On SQL Server I receive Login succeeded, yet via code I get Login failed for user 'geneva'. I verified the login in SSMS and am able to connect via Windows authetnication. The sql user has full rights. Tried via java/.net code, really unsure why I am unable to connect via SQL Auth.
Data Source=server;Initial Catalog=GenevaWorkflow;User ID=user;Password=password
The environment is SQL Server 2008/Windows 2008. Very frustrating being all I want is to connect via SQL authentication and SQL Server I set to mixed mode authentication.
Enable sql logins in server properties (from management studio) and restart sql server.