# Use of SQL Server 2005 from the non-domain machine using Home windows authentication

I've got a Home windows domain within that your machine is running SQL Server 2005 and that is set up to aid only Home windows authentication. I must operate a C# client application on the machine on a single network, but that is This is not on the domain, and access a database around the SQL Server 2005 instance.

I figured that it might be rather simple to do something similar to this:

string connectionString = "DatabasesEqualsserverInitial Catalog=databaseUser Id=domainuserPassword=password" SqlConnection connection = new SqlConnection(connectionString) connection.Open()

However, this fails: the customer-side error is: System.Data.SqlClient.SqlException: Login unsuccessful for user 'domainuser' and also the server-side error is: Error 18456, Severity 14, Condition 5

I've attempted something more important including setting integrated security to true and false, and rather than within the User Id, but with no success.

Generally, I understand it easy to connect with the SQL Server 2005 instance from the non-domain machine (for instance, I'm using a Linux-based application which happily performs this), however i don't appear to have the ability to see how to get it done from the Home windows machine.

Help could be appreciated! Thanks, Martin

With Management Studio when hooking up to some server on another domain via Home windows Authentication you should utilize the "runas" Facility when beginning the applying.

 runas /user:OTHERDOMAINOTHERUSERNAME  /netonly

"C:Program FilesMicrosoft SQL Server100ToolsBinnVSShellCommon7IDESsms.exe"



Maybe you could attempt an similar factor when beginning the application?

(Per Martin Smith's answer) I personally use RUNAS /NETONLY constantly to operate SSMS and also the BI dev studio and Visual Studio IDE along with other third party programs against a server on the domain we don't authenticate against. I am unsure the reason why you can't do that - you have to in some way come with an account on that domain which works together with SQL Server if you work with integrated security.

Additionally, I modified among my primary C# programs to make use of CreateProcessWithLogonW with LOGON_NETCREDENTIALS_ONLY (http://stackoverflow.com/questions/757857/how-to-build-runas-netonly-functionality-into-a-c-internet-winforms-program/758805#758805) to ensure that it prompts for password after which re-launches itself.

Utilizing the same API, I additionally designed a version of RUNAS /NETONLY that will pay a password around the command-line, since RUNAS won't allow your password around the command-line. Clearly, it is really an natural security risk, and that i avoid using it frequently.

Ought to be completeness, there's also this excellent spend extension: http://technet.microsoft.com/en-us/sysinternals/cc300361.aspx - the standard Run As Spend extension does not be capable of do the same as /NETONLY.

You'll be able to produce a local user on each machine with similar user title and password Once these customers happen to be produced provide the user around the SQL server machine use of SQL server, in your other machine the application should be running because the recently produced user, if is really a web application simply change application pool configurations.

Have you try hooking up with machineNameUserName ? I'd also suppose this type of user ought to be produced within the SQL database well correct?

runas won't be acceptable due to the ways we'll be utilising the C# application. The issue I'm getting with all the suggested solutions is they pre-suppose some have to either alter the identity around the client side in order to synchronize in some manner user accounts around the client and server side.

However, generally I understand that that you'll be able to connect with the SQL Server instance without having done either of those things because I'm able to make use of the application running around the Linux box I pointed out during my first publish. Within this application, I only pass within the four parameters (server, database, domainuser, and password) and also the application connects quite happily. How one thing a non-Home windows box running Perl can perform such a Home windows box running C# cannot?

Thank you for any help. Martin