MSSQL: "Login failed for user 'Servername\Guest'" after moving an app from SQL 2008 to a SQL 2012 server

Applies to: a C9 application, SQL Server Developer 2008 (the old setup) and SQL Server 2012 (the new server), as reported.

Problem

The application worked on a desktop with SQL Server Developer 2008, Windows Authentication, Trusted Connection and Logon=FALSE set in the dictionary, with the global owner string server,database,uid,password. The database was backed up and restored to a SQL Server 2012 instance that uses SQL Server Authentication. The open then failed with File dbo.Brands could not be opened. Error: Login failed for user 'Servername\Guest'. After removing the trusted setting, a logon box appeared although Logon=False was still set. Using ip\server in the owner string did not work.

Solution

  1. Do not combine TrustedConnection with SQL Server Authentication; the two are mutually exclusive.
  2. For a named instance the form is ServerName\InstanceName, for example My-PC\SQLExpress,DatabaseName,uid,password for an Express default instance name.
  3. Set the global connection string very early, or the login screen can appear because it was set too late.
  4. SQL 2012 is stricter than 2008: the Guest user is disabled, and so is sa unless you enable it. A password that is not long and complex enough can block the connection.
  5. Check that the Windows user on the client PC has permission to connect to the new server.

The poster and his network administrator got the connection working after tweaking the SQL settings, and the application then ran without the login box. The thread does not say which single change fixed it.

Caveats

  • The connection string server,database,uid,password was confirmed valid by a poster, subject to the password rules.
  • A poster pointed to his own web page with details of several cases; its content is not in the archive.

Today (2026)

Likely unchanged in principle: SQL authentication and a trusted connection do not mix, and current servers are at least as strict. Not re-tested.

Sources: Linda S. (Oct 2014, the question), Graham D., John G. (Oct 2014) in softvelocity.clarion.databasedrivers.