MS SQL server 2005 Login failed error 18456 Severity 14 State 16
-
Saturday, May 19, 2012 5:51 AM
Hi,
I get the 2 following lines in the SQL server 2005 log file:
05/19/2012 12:07:16,Logon,Unknown,Login failed for user 'Ultimate-PC\Ultimate'. [CLIENT: 127.0.0.1]
05/19/2012 12:07:16,Logon,Unknown,Error: 18456<c/> Severity: 14<c/> State: 16.
I have looked at many other MSDN posts and other forums and after 3 hours trying, I still get the same error.
I am trying to have a Java program connect to the DB using JDBC, connection string: "jdbc:sqlserver://localhost;databaseName=CUMISBD;integratedSecurity=true". I use the JDBC driver provided by Microsoft. In SQL Management Studio, I have tried granted all the possible roles to the dabase user "yves" onto CUMISDB database, and my Windows 7 login is mapped to "yves" in SQL server.
In SQL management studio:
- The server authentication is set to "Windows Authentication Mode"
- The login "Ultimate-PC\Ultimate" has Default database = CUMISDB, and all the available Server Roles are selected (bulkadmin, dbcreator, diskadmin, processadmin, public, securityadmin, serveradmin, setupadmin, and sysadmin). For the user mapping please see screenshot below.
- In CUMISDB, user "yves" doesn't have anything displayed in the "Securables" page (CUMISDB ->Security -> Users -> yves -> right click and properties -> Securables). Maybe that is a problem? For the general page please see the following screenshot:
I have verified in a local file explorer and the user "Ultimate-PC\Ultimate" has "Full control" permissions onto the database file "C:\vfxcoopsql\data\CUMISDB.mdf".
The following is the error message onto my JDBC client:
Error: java.lang.Exception: Cannot open database "CUMISBD" requested by the login. The login failed. ClientConnectionId:03dd54ce-95e8-48cd-a5f0-4ca4494490e3 Stack Trace: java.sql.SQLException: java.lang.Exception: Cannot open database "CUMISBD" requested by the login. The login failed. ClientConnectionId:03dd54ce-95e8-48cd-a5f0-4ca4494490e3 at com.edb.MigrationToolkit.initToolkit(MigrationToolkit.java:2547) at com.edb.MigrationToolkit.main(MigrationToolkit.java:1257)
It would be nice if msdn could allow to upload more than 2 images then I could put more screenshots. Any help would be greatly appreciated and please let me know in case you need more information.
Yves.
All Replies
-
Saturday, May 19, 2012 8:39 AM
State 40 means that the login is not able to access the requested database. What happens if you log into Windows as Ultimate-PC\Ultimate, and then log in to SSMS and say "USE CUMISDB"? Are you able to access it?
To be honest, I don't know that these screens mean - I never use them myself. What output do you get from this query:
select suser_sname(sid), name, type_desc from CUMISDB.sys.database_principals
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se -
Sunday, May 20, 2012 8:02 AM
Please check this, may be helpful for you.
http://go4answers.webhost4life.com/Example/login-failure-error-18456-severity-50959.aspx
-
Tuesday, May 22, 2012 3:09 AMModerator
Hi ybastian,
The login "Ultimate-PC\Ultimate" has Default database = CUMISDB. In the Server Roles, you just need to select sysadmin. Members of the sysadmin fixed server role can perform any activity in the server. The login "Ultimate-PC\Ultimate" is mapped to the user yves. In the Database User page, you just need to choose db_owner in Role Members. Db_owner has the highest privilege. That is OK.
Please try to use the user ”yves” which mapped to "Ultimate-PC\Ultimate" to access the database” CUMISDB” through SQL Server Management Studio. And let me know if it is OK.
JDBC Driver: http://msdn.microsoft.com/en-us/library/ms378749.aspx.
In addition, error state 16 indicates an internal error. Reference: http://blogs.msdn.com/b/sql_protocols/archive/2006/02/21/536201.aspx.
Thanks,
MaggiePlease remember to mark the replies as answers if they help and unmark them if they provide no help. This can be beneficial to other community members reading the thread.
-
Tuesday, May 22, 2012 8:07 AM
Hello and thank you all for your help.
In reply to Erland Sommarskog:
I successfully ran the SQL query "USE CUMISDB" in SSMS. After this I still get the same error on JDBC client and in the SQL server logs.
Following is the SSMS screenshot, output of "select suser_sname(sid), name, type_desc from CUMISDB.sys.database_principals".
In reply to Maggie Luo: I have given the sysadmin role only in the Server Roles.
In the Database User page, I have checked db_owner only in Role Members. I still get the same error.In reply to lindaEtechi: I had already tried everything mentioned at http://go4answers.webhost4life.com/Example/login-failure-error-18456-severity-50959.aspx, unfortunately to no avail.The version of the JDBC driver I am using is sqljdbc_4.0.2206.100_enu.exe downloaded from here: http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11774
- Edited by ybastian Tuesday, May 22, 2012 9:31 AM
-
Tuesday, May 22, 2012 9:28 AMI can connect to CUMISDB using the software program DBConvert (http://www.dbconvert.com/convert-mssql-to-postgre-pro.php)without any problem. The problem might be on the client side with JDBC where I get the following error: Error: java.lang.Exception: Cannot open database "CUMISBD" requested by the login. The login failed. ClientConnectionId:6087cf82-b3f9-4b04-96d1-62459c74634c The connection from DBConvert creates lots of entries into the SQL server log. Here is one of them: 05/22/2012 16:49:09,Logon,Unknown,Login succeeded for user 'Ultimate-PC\Ultimate'. Connection: trusted. [CLIENT: 127.0.0.1]
- Edited by ybastian Tuesday, May 22, 2012 9:52 AM
-
Tuesday, May 22, 2012 1:33 PM
Hi,
On what TCP port is your SQL Server running?
If it's other than default 1433, you should specify it somewhere on the JDBC connection string.
Here's Microsoft JDBC connection string syntax :
http://msdn.microsoft.com/en-us/library/ms378428.aspx
Sebastian Sajaroff Senior DBA Pharmacies Jean Coutu
-
Tuesday, May 22, 2012 1:42 PM
Hi,
It may also be worth turning off UAC temporarily to see if that helps - I'd have expected one of the previously given suggestions to hav eworked, but given that you're still having problems, it may be worth a go.
Thanks,
Andrew Bainbridge
SQL Server DBA
Please click "Propose As Answer" if a post solves your problem, or "Vote As Helpful" if a post has been useful to you -
Tuesday, May 22, 2012 9:49 PM
OK, I think have got it. Read the error message. Carefully.
following error: Error: java.lang.Exception: Cannot open database "CUMISBD" requested by the login. The login failed.
Particularly, pay attention to the last two letters in the database name.
The error message is also consistent with the connection string in your initial post.
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se- Marked As Answer by ybastian Wednesday, May 23, 2012 3:09 AM
-
Wednesday, May 23, 2012 3:10 AMDang it, my apologies for having made such a mistake. Thanks Erland and thank you all for your help.
-
Wednesday, May 23, 2012 9:57 PM

