Sql-server – Connecting to SQL Server outside the domain with SQL Authentication

authenticationcross-domainsql server

I have a C# application that connects to a SQL server with SQL authentication, but the machines that are to be using it aren't on the domain.

I've been trying to solve this for several days now. On my development machine the connection string works perfectly fine and isn't using Windows authentication. As soon as it is on one of the others outside the domain, including non-domain accounts on my machine, this error occurs.

login failed. the login is from an untrusted domain and cannot be used with windows authentication. Error: 18452

The connection string is (details omitted and edited for readability):

Data Source=[servername];

Initial Catalog=[Database];

Persist Security Info=True;

User ID=[username];



I've also tried additional string options such as Trusted_Connection (tried true and false) and Integrated Security=SSPI.

All the server connection settings are correct (allow remote connection, ports, both Windows and SQL authentication allowed), and I can connect to the server on SSMS using the username and password just fine.

Assuming my settings are correct (there's bound to be something wrong somewhere), doesn't this defeat the point of using a SQL user login if I can't log in remotely? Anyway, any help is appreciated.

Best Answer

Fair warning: I am not a C# developer (nor do I play one on TV).

The error message insists it's trying to use windows authentication, even if you're not. ("Integrated Security=SSPI" means you're using Windows authentication, for example, as does "Trusted Connection.") So I'm wondering if one of the details you've left out is for windows authentication only.

This MSDN link is for SQL Authentication only and may or may not help you. This MSDN link is for Windows Authentication only and may tell you options you need to avoid.