none
Login failed for user What is wrong?

    Question

  • I Developed a program in VB.NET 2010  using SQL server 2008 R2. Is for installing in any machine, as a prouct to sell, so instalation must by simple. I used a lot of time perfectly, linkink the database to the program normaly. I didn´t change anything in database or VB.NET ccode, only developed an INNO instaler. Now doesn,t work, gives Logon Failed for user xxxx. I tried to  run in three different computers/windows and always failed even if I used the debuger in the original code that wasn´t modified.  I attach part of the code, the data bank is in C:\orcamento\orcamento.mdf and I can see the tables and its content, so is working.......What is wrong???????????

     

    Friday, October 28, 2011 6:28 PM

Answers

  • If this was working and nothing has change in the application code or the connection string with using the integrated security. Are you logged into the machine with the same account that you were logged in as when it was working ?

    As Rick has stated above, check the SQL Error log for login failures.

    As George stated are you able to connect with the user account directly into the instance of sql server ?

    Does the account you are logged into the machine with and are trying to connect to SQL Server with have the appropriate permissions to access not just the instance of SQL Server but also the appropriate database the application needs to connect to ?

    I hope this helps


    Warwick Rudd
    MCT MCITP SQL Server 2008 Admin
    My Blog
    -------------------------------------------------------
    Please mark as Answered if I have answered your question
    Please vote if this was useful
    -------------------------------------------------------
    Movember is here. Show your support for Mens Health
    by making a donation here - Movember
    • Proposed as answer by Iric WenModerator Tuesday, November 8, 2011 12:58 AM
    • Marked as answer by Stephanie Lv Wednesday, November 9, 2011 9:28 AM
    Thursday, November 3, 2011 9:22 AM

All replies

  • Your code snippet shows that you are attempting to connect with Integrated Security. Aside from beginning at the beginning (can the user connect to the server outside of the application?), I would follow these steps for accessing SQL using Integrated Security.

    http://msdn.microsoft.com/en-us/library/aa984236(v=VS.71).aspx

     

     

    Friday, October 28, 2011 6:36 PM
  • A standard security connection string will be something like - 

    Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

    Below link will confirm you possible connections strings 

    http://www.connectionstrings.com/sql-server-2008


    Anup | Forum Support| If you think my suggestion is useful, please rate it as helpful. If it has helped you to resolve the problem, please Mark it as Answer.
    Friday, October 28, 2011 6:41 PM
  • Thank You

    But I am trying to recognize from the windows the user/password, becouse as is a comercial software I don´t know who will use it!

    This didn´t work > Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;!!!!!!!!

    Monday, October 31, 2011 6:47 PM
  • What error do you receive? Check the SQL Server error log for details about login errors.
    Rick Byham, Microsoft, SQL Server Books Online, Implies no warranty
    Monday, October 31, 2011 8:24 PM
    Moderator
  • Hello,

    Can you post the exact error which you are getting.


    Anup | Forum Support| If you think my suggestion is useful, please rate it as helpful. If it has helped you to resolve the problem, please Mark it as Answer.
    Tuesday, November 1, 2011 4:59 PM
  • If this was working and nothing has change in the application code or the connection string with using the integrated security. Are you logged into the machine with the same account that you were logged in as when it was working ?

    As Rick has stated above, check the SQL Error log for login failures.

    As George stated are you able to connect with the user account directly into the instance of sql server ?

    Does the account you are logged into the machine with and are trying to connect to SQL Server with have the appropriate permissions to access not just the instance of SQL Server but also the appropriate database the application needs to connect to ?

    I hope this helps


    Warwick Rudd
    MCT MCITP SQL Server 2008 Admin
    My Blog
    -------------------------------------------------------
    Please mark as Answered if I have answered your question
    Please vote if this was useful
    -------------------------------------------------------
    Movember is here. Show your support for Mens Health
    by making a donation here - Movember
    • Proposed as answer by Iric WenModerator Tuesday, November 8, 2011 12:58 AM
    • Marked as answer by Stephanie Lv Wednesday, November 9, 2011 9:28 AM
    Thursday, November 3, 2011 9:22 AM
  • Error Log :
    Apr 22 2011 19:23:43 
    	Copyright (c) Microsoft Corporation
    	Express Edition with Advanced Services (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
    
    2011-11-16 13:10:34.54 Server      (c) Microsoft Corporation.
    2011-11-16 13:10:34.54 Server      All rights reserved.
    2011-11-16 13:10:34.54 Server      Server process ID is 2748.
    2011-11-16 13:10:34.57 Server      System Manufacturer: 'Hewlett-Packard', System Model: 'p6660br'.
    2011-11-16 13:10:34.57 Server      Authentication mode is WINDOWS-ONLY.
    2011-11-16 13:10:34.57 Server      Logging SQL Server messages in file 'c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
    2011-11-16 13:10:34.68 Server      This instance of SQL Server last reported using a process ID of 432 at 15/11/2011 22:31:36 (local) 16/11/2011 00:31:36 (UTC). This is an informational message only; no user action is required.
    2011-11-16 13:10:34.68 Server      Registry startup parameters: 
    	 -d c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf
    	 -e c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
    	 -l c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    2011-11-16 13:10:35.78 Servidor    SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
    2011-11-16 13:10:35.79 Servidor    Detected 4 CPUs. This is an informational message; no user action is required.
    2011-11-16 13:10:39.24 Servidor    Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
    2011-11-16 13:10:41.00 Servidor    Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
    2011-11-16 13:10:41.79 spid7s      Starting up database 'master'.
    2011-11-16 13:10:43.08 spid7s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
    2011-11-16 13:10:43.94 spid7s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'MSSQLSERVER'.
    2011-11-16 13:10:45.07 spid7s      SQL Trace ID 1 was started by login "sa".
    2011-11-16 13:10:45.28 spid7s      Starting up database 'mssqlsystemresource'.
    2011-11-16 13:10:46.38 spid7s      The resource database build version is 10.50.1617. This is an informational message only. No user action is required.
    2011-11-16 13:10:50.94 spid10s     Starting up database 'model'.
    2011-11-16 13:10:50.97 spid7s      Server name is 'NICOLAS-HP'. This is an informational message only. No user action is required.
    2011-11-16 13:10:51.38 spid7s      Informação: não foram encontrados idiomas com suporte a texto completo.
    2011-11-16 13:10:51.63 spid7s      Starting up database 'msdb'.
    2011-11-16 13:10:53.57 Servidor    A self-generated certificate was successfully loaded for encryption.
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\sql\query ].
    2011-11-16 13:10:53.61 Servidor    Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
    2011-11-16 13:10:54.00 Servidor    The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
    2011-11-16 13:10:54.02 Servidor    SQL Server is now ready for client connections. This is an informational message; no user action is required.
    2011-11-16 13:10:57.38 spid10s     Clearing tempdb database.
    2011-11-16 13:11:01.69 spid10s     Starting up database 'tempdb'.
    2011-11-16 13:11:02.94 spid13s     The Service Broker protocol transport is disabled or not configured.
    2011-11-16 13:11:02.95 spid13s     The Database Mirroring protocol transport is disabled or not configured.
    2011-11-16 13:11:03.58 spid13s     Service Broker manager has started.
    2011-11-16 13:11:03.87 spid7s      Recovery is complete. This is an informational message only. No user action is required.
    2011-11-16 16:06:13.82 Servidor    Server resumed execution after being idle 8670 seconds: user activity awakened the server. This is an informational message only. No user action is required.
    2011-11-16 16:07:13.35 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:15.85 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:20.81 spid51      Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.
    2011-11-16 16:07:21.18 spid51      Using 'xpstar.dll' version '2009.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.
    2011-11-16 16:07:23.04 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:44.21 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:58.00 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:09:12.07 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:16:11.16 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:17:45.17 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:20:09.60 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:22:40.79 Logon       Erro: 18456, Gravidade: 14, Estado: 38.
    2011-11-16 16:22:40.79 Logon       Login failed for user 'Nicolas-HP\Nicolas'. Motivo: falha ao abrir o banco de dados explicitamente especificado. [CLIENTE: <local machine>]
    
    

    Wednesday, November 16, 2011 6:46 PM
  • Error Log
    
    Apr 22 2011 19:23:43 
    	Copyright (c) Microsoft Corporation
    	Express Edition with Advanced Services (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
    
    2011-11-16 13:10:34.54 Server      (c) Microsoft Corporation.
    2011-11-16 13:10:34.54 Server      All rights reserved.
    2011-11-16 13:10:34.54 Server      Server process ID is 2748.
    2011-11-16 13:10:34.57 Server      System Manufacturer: 'Hewlett-Packard', System Model: 'p6660br'.
    2011-11-16 13:10:34.57 Server      Authentication mode is WINDOWS-ONLY.
    2011-11-16 13:10:34.57 Server      Logging SQL Server messages in file 'c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
    2011-11-16 13:10:34.68 Server      This instance of SQL Server last reported using a process ID of 432 at 15/11/2011 22:31:36 (local) 16/11/2011 00:31:36 (UTC). This is an informational message only; no user action is required.
    2011-11-16 13:10:34.68 Server      Registry startup parameters: 
    	 -d c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf
    	 -e c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
    	 -l c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    2011-11-16 13:10:35.78 Servidor    SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
    2011-11-16 13:10:35.79 Servidor    Detected 4 CPUs. This is an informational message; no user action is required.
    2011-11-16 13:10:39.24 Servidor    Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
    2011-11-16 13:10:41.00 Servidor    Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
    2011-11-16 13:10:41.79 spid7s      Starting up database 'master'.
    2011-11-16 13:10:43.08 spid7s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
    2011-11-16 13:10:43.94 spid7s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'MSSQLSERVER'.
    2011-11-16 13:10:45.07 spid7s      SQL Trace ID 1 was started by login "sa".
    2011-11-16 13:10:45.28 spid7s      Starting up database 'mssqlsystemresource'.
    2011-11-16 13:10:46.38 spid7s      The resource database build version is 10.50.1617. This is an informational message only. No user action is required.
    2011-11-16 13:10:50.94 spid10s     Starting up database 'model'.
    2011-11-16 13:10:50.97 spid7s      Server name is 'NICOLAS-HP'. This is an informational message only. No user action is required.
    2011-11-16 13:10:51.38 spid7s      Informação: não foram encontrados idiomas com suporte a texto completo.
    2011-11-16 13:10:51.63 spid7s      Starting up database 'msdb'.
    2011-11-16 13:10:53.57 Servidor    A self-generated certificate was successfully loaded for encryption.
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\sql\query ].
    2011-11-16 13:10:53.61 Servidor    Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
    2011-11-16 13:10:54.00 Servidor    The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
    2011-11-16 13:10:54.02 Servidor    SQL Server is now ready for client connections. This is an informational message; no user action is required.
    2011-11-16 13:10:57.38 spid10s     Clearing tempdb database.
    2011-11-16 13:11:01.69 spid10s     Starting up database 'tempdb'.
    2011-11-16 13:11:02.94 spid13s     The Service Broker protocol transport is disabled or not configured.
    2011-11-16 13:11:02.95 spid13s     The Database Mirroring protocol transport is disabled or not configured.
    2011-11-16 13:11:03.58 spid13s     Service Broker manager has started.
    2011-11-16 13:11:03.87 spid7s      Recovery is complete. This is an informational message only. No user action is required.
    2011-11-16 16:06:13.82 Servidor    Server resumed execution after being idle 8670 seconds: user activity awakened the server. This is an informational message only. No user action is required.
    2011-11-16 16:07:13.35 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:15.85 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:20.81 spid51      Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.
    2011-11-16 16:07:21.18 spid51      Using 'xpstar.dll' version '2009.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.
    2011-11-16 16:07:23.04 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:44.21 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:58.00 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:09:12.07 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:16:11.16 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:17:45.17 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:20:09.60 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:22:40.79 Logon       Erro: 18456, Gravidade: 14, Estado: 38.
    2011-11-16 16:22:40.79 Logon       Login failed for user 'Nicolas-HP\Nicolas'. Motivo: falha ao abrir o banco de dados explicitamente especificado. [CLIENTE: <local machine>]
    
    

    Wednesday, November 16, 2011 6:47 PM
  • Error Log
    
    Apr 22 2011 19:23:43 
    	Copyright (c) Microsoft Corporation
    	Express Edition with Advanced Services (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
    
    2011-11-16 13:10:34.54 Server      (c) Microsoft Corporation.
    2011-11-16 13:10:34.54 Server      All rights reserved.
    2011-11-16 13:10:34.54 Server      Server process ID is 2748.
    2011-11-16 13:10:34.57 Server      System Manufacturer: 'Hewlett-Packard', System Model: 'p6660br'.
    2011-11-16 13:10:34.57 Server      Authentication mode is WINDOWS-ONLY.
    2011-11-16 13:10:34.57 Server      Logging SQL Server messages in file 'c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
    2011-11-16 13:10:34.68 Server      This instance of SQL Server last reported using a process ID of 432 at 15/11/2011 22:31:36 (local) 16/11/2011 00:31:36 (UTC). This is an informational message only; no user action is required.
    2011-11-16 13:10:34.68 Server      Registry startup parameters: 
    	 -d c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\master.mdf
    	 -e c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG
    	 -l c:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    2011-11-16 13:10:35.78 Servidor    SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.
    2011-11-16 13:10:35.79 Servidor    Detected 4 CPUs. This is an informational message; no user action is required.
    2011-11-16 13:10:39.24 Servidor    Using dynamic lock allocation.  Initial allocation of 2500 Lock blocks and 5000 Lock Owner blocks per node.  This is an informational message only.  No user action is required.
    2011-11-16 13:10:41.00 Servidor    Node configuration: node 0: CPU mask: 0x000000000000000f:0 Active CPU mask: 0x000000000000000f:0. This message provides a description of the NUMA configuration for this computer. This is an informational message only. No user action is required.
    2011-11-16 13:10:41.79 spid7s      Starting up database 'master'.
    2011-11-16 13:10:43.08 spid7s      Recovery is writing a checkpoint in database 'master' (1). This is an informational message only. No user action is required.
    2011-11-16 13:10:43.94 spid7s      FILESTREAM: effective level = 0, configured level = 0, file system access share name = 'MSSQLSERVER'.
    2011-11-16 13:10:45.07 spid7s      SQL Trace ID 1 was started by login "sa".
    2011-11-16 13:10:45.28 spid7s      Starting up database 'mssqlsystemresource'.
    2011-11-16 13:10:46.38 spid7s      The resource database build version is 10.50.1617. This is an informational message only. No user action is required.
    2011-11-16 13:10:50.94 spid10s     Starting up database 'model'.
    2011-11-16 13:10:50.97 spid7s      Server name is 'NICOLAS-HP'. This is an informational message only. No user action is required.
    2011-11-16 13:10:51.38 spid7s      Informação: não foram encontrados idiomas com suporte a texto completo.
    2011-11-16 13:10:51.63 spid7s      Starting up database 'msdb'.
    2011-11-16 13:10:53.57 Servidor    A self-generated certificate was successfully loaded for encryption.
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\SQLLocal\MSSQLSERVER ].
    2011-11-16 13:10:53.61 Servidor    Server local connection provider is ready to accept connection on [ \\.\pipe\sql\query ].
    2011-11-16 13:10:53.61 Servidor    Dedicated administrator connection support was not started because it is disabled on this edition of SQL Server. If you want to use a dedicated administrator connection, restart SQL Server using the trace flag 7806. This is an informational message only. No user action is required.
    2011-11-16 13:10:54.00 Servidor    The SQL Server Network Interface library could not register the Service Principal Name (SPN) for the SQL Server service. Error: 0x54b, state: 3. Failure to register an SPN may cause integrated authentication to fall back to NTLM instead of Kerberos. This is an informational message. Further action is only required if Kerberos authentication is required by authentication policies.
    2011-11-16 13:10:54.02 Servidor    SQL Server is now ready for client connections. This is an informational message; no user action is required.
    2011-11-16 13:10:57.38 spid10s     Clearing tempdb database.
    2011-11-16 13:11:01.69 spid10s     Starting up database 'tempdb'.
    2011-11-16 13:11:02.94 spid13s     The Service Broker protocol transport is disabled or not configured.
    2011-11-16 13:11:02.95 spid13s     The Database Mirroring protocol transport is disabled or not configured.
    2011-11-16 13:11:03.58 spid13s     Service Broker manager has started.
    2011-11-16 13:11:03.87 spid7s      Recovery is complete. This is an informational message only. No user action is required.
    2011-11-16 16:06:13.82 Servidor    Server resumed execution after being idle 8670 seconds: user activity awakened the server. This is an informational message only. No user action is required.
    2011-11-16 16:07:13.35 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:15.85 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:07:20.81 spid51      Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.
    2011-11-16 16:07:21.18 spid51      Using 'xpstar.dll' version '2009.100.1600' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.
    2011-11-16 16:07:23.04 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:44.21 spid51      Starting up database 'ORCAMENTO'.
    2011-11-16 16:08:58.00 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:09:12.07 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:16:11.16 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:17:45.17 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:20:09.60 spid53      Starting up database 'ORCAMENTO'.
    2011-11-16 16:22:40.79 Logon       Erro: 18456, Gravidade: 14, Estado: 38.
    2011-11-16 16:22:40.79 Logon       Login failed for user 'Nicolas-HP\Nicolas'. Motivo: falha ao abrir o banco de dados explicitamente especificado. [CLIENTE: <local machine>]
    
    

    Wednesday, November 16, 2011 6:48 PM