0

Have a C# App and SQL Server database from a domain environment; restored the DB in a non-domain support environment (SQL Server running in a Docker Container). Connections are successful via ODBC using SQL Server authentication:

Server         10.0.0.1
LoginID        <username of dbOwner>
Password       <password>
Default db     ThisProject

The C# App, however, always returns "Login failed: The login is from an untrusted domain" with every variation of a normal connect string:

data source=10.0.0.1;
initial catalog=ThisProject;
integrated security=False; 
User Id=<dbOsner>;
Password=<password>;
Trusted_Connection=False;

How does one configure the connect string so that the C# App connects with SQL Server authentication?

TIA!

Tested with variations:

integrated security=False, True, SSPI, <missing>;
trusted_Connection=False, True;
9
  • 1
    Pick any (appropriate) of: connectionstrings.com/sql-server ? Commented Feb 14, 2023 at 17:43
  • Are the credentials you are using for a SQL Server account or a domain account? If it is a domain account, it won't work if the SQL Server isn't joined to the domain. Commented Feb 14, 2023 at 18:03
  • Yes, .. tried connectionstrings.com/sql-server, but no examples for SQL Server authentication and there is no domain server here in the lab. The dbOwner is a SQL Server user. Commented Feb 14, 2023 at 18:49
  • Here is an example of what we use, you would of course need to replace the placeholders with the appropriate values for your server: "Server=tcp:10.0.0.1,1433;Initial Catalog=<DBName>;User ID=<username>;Password=<password>;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" Commented Feb 14, 2023 at 18:53
  • Nice, .. but no difference; connection still refused due to untrusted domain. We did not build the original App, is there anything else that would force a domain trust outside the connect string? Commented Feb 14, 2023 at 20:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.