Unable to Connect to SQL Server Due to Error: 18456, Severity: 14, State: 12

Troubleshooting Databases

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

  • The following error appears in the SQL Server log:

    Login failed for user '<STASH_USER>'. Reason: Login-based server access validation failed with an infrastructure error. Check for previous errors. [Client: 127.0.0.1]
    Error: 18456, Severity: 14, State: 12
  • The following appears in the atlassian-stash.log:

    2015-04-09 13:53:16,046 WARN  [http-nio-80-exec-7] user @1BFSM6Dx833x1035x0 35ndgf 192.168.30.100 "POST /admin/db/edit HTTP/1.1" c.a.s.i.db.DefaultDatabaseManager A connection could not be opened with the DataSource
    org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user '<STASH_USER>'. ClientConnectionId:

Cause

Error: 18456, Severity: 14, State: 12 means that the authentication is successful, but the server access fails due to permission.

Resolution

  • Ensure that the SQL Server Authentication mode is enabled.
  • Assuming that the SQL Server username is stashuser, run the following SQL query in a master database, to give the permission to connect via TCP/IP

    GRANT CONNECT SQL TO "stashuser"
    GRANT CONNECT ON ENDPOINT::"TSQL Default TCP" TO "stashuser";

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.